<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>

CC BY-SA 4.0
2020-11-02T17:48:51.797Z
Thanks for the answer! This definitely helps.

Looks like I'm learning Kubernetes after all!
ChrisW
CC BY-SA 4.0
2020-10-30T20:53:57.777Z
2020-10-30T20:53:57.777Z
Hedi Nasr
<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>

<docker><kubernetes><persistent-volumes>
Docker update with persistent storage and 0 downtime
ChrisW
# 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, 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!  

---

