title: How to use swap memory in docker-compose
body: <p>I want to use swap memory in my dockerized application because sometimes the container's memory consumption exceeds the limit and they get crashed.</p>
  <p>I am using the below configuration in docker-compose which produces an error</p>
  <pre><code>ERROR: The Compose file './docker-compose.yml' is invalid because:
  services.app1-cnn.deploy.resources.reservations value Additional properties are not allowed ('memory-swap' was unexpected)
  </code></pre>
  <p><strong>docker-compose.yml</strong></p>
  <pre><code>version: &quot;3.3&quot;             
  
  services:
  
    app-cnn:
      build: ./app
      image: &quot;app-cnn&quot;
      restart: always
      container_name: app-cnn
      ports:
        - &quot;5000:5000&quot;
  
      deploy:
        replicas: 1
        resources:
          limits:
            memory: 3G
          reservations:
            memory-swap: 6G
  </code></pre>