title: Zero down-time deployments using docker-compose?
body: <p>I've pulled together a cd solution for my own little personal projects using <code>docker-compose</code>, but no matter what I try I have ~10 seconds of down-time every time I redeploy.</p>
  
  <p>My CI service uploads new docker images under certain tags, and then hits a webhook. The webhook triggers the following script:</p>
  
  <pre><code>docker-compose pull
  docker-compose up -d
  </code></pre>
  
  <p><strong>Here is my <code>docker-compose</code>:</strong></p>
  
  <pre><code>version: '3'
  
  services:
    backend:
      restart: always
      image: &lt;image name&gt;/backend:latest
      deploy:
        replicas: 2
      networks:
        - back
    static:
      restart: always
      image: &lt;image name&gt;/static:latest
      deploy:
        replicas: 2
      depends_on:
        - backend
      ports:
        - "7180:80"
      networks:
        - front
        - back
  
  networks:
    front:
    back:
  </code></pre>
  
  <p>The <code>replicas</code> seems to be ignored, since I'm not in swarm mode. I'm not 100% sure what swarm mode is. I'm starting to venture into several areas I'm not very comfortable, and thought I'd seek some advice. <strong>What should I do to have zero down-time deployments?</strong></p>