Answers: <p>Docker itself does not provide such rolling update feature. You have to do it by hand which is not an easy task. Even if you want to use a one node Swarm cluster, the scheduler does have downtime.</p>
  <pre><code>The scheduler applies rolling updates as follows by default:
  
  Stop the first task.
  Schedule update for the stopped task.
  Start the container for the updated task.
  </code></pre>
  <p>If you only have one machine, you can try something like <a href="https://k3s.io" rel="nofollow noreferrer">k3s</a>, which is a lightweight Kubernetes distribution. You'll be able to use a Deployment, a Kubernetes object, which provide zero downtime rolling update feature.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-11-02T17:48:51.797Z
Answers: Thanks for the answer! This definitely helps.
  
  Looks like I'm learning Kubernetes after all!
Answers: ChrisW
Answers: CC BY-SA 4.0
Answers: 2020-10-30T20:53:57.777Z
Answers: 2020-10-30T20:53:57.777Z
Answers: Hedi Nasr
Body: <p>I have a docker container running with persistent storage. When I try to update now I kill the container, and rerun the updated image all over again.</p>
  <p>I've considered setting up the new container first, then switching traffic over via NginX, but how would this work with persistent storage? I can't bind the same data to two different containers can I?</p>
  <p>Most questions and googling I've done suggest moving over to kubernetes, but for a single-host, 3 container setup, it doesn't seem worth it for such a small application.</p>
  
Tags: <docker><kubernetes><persistent-volumes>
Title: Docker update with persistent storage and 0 downtime
UserDisplayName: ChrisW
ThreadText: # Docker update with persistent storage and 0 downtime
  
  (Asked by: username_0 on 2020-10-28)
  
  I have a docker container running with persistent storage. When I try to update now I kill the container, and rerun the updated image all over again.
  
  I've considered setting up the new container first, then switching traffic over via NginX, but how would this work with persistent storage? I can't bind the same data to two different containers can I?
  
  Most questions and googling I've done suggest moving over to kubernetes, but for a single-host, 3 container setup, it doesn't seem worth it for such a small application.
  
  **Tags:** docker, kubernetes, persistent-volumes
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-10-30. Score: 0 | Accepted answer
  
  Docker itself does not provide such rolling update feature. You have to do it by hand which is not an easy task. Even if you want to use a one node Swarm cluster, the scheduler does have downtime.
  
  ```
  The scheduler applies rolling updates as follows by default:
  
  Stop the first task.
  Schedule update for the stopped task.
  Start the container for the updated task.
  
  ```
  
  If you only have one machine, you can try something like [k3s](https://k3s.io), which is a lightweight Kubernetes distribution. You'll be able to use a Deployment, a Kubernetes object, which provide zero downtime rolling update feature.
  
  > **Comments:**
  > **username_0**: Thanks for the answer! This definitely helps.  Looks like I'm learning Kubernetes after all!  
  
  ---
  
  