Reputation: 2251
I am running a service on Docker Swarm. This is what I did to deploy the service:
docker swarm init
docker stack deploy -c docker-compose.yml MyApplication
Content of docker-compose.yml:
version: "3"
services:
web:
image: myimage:1.0
ports:
- "9000:80"
- "9001:443"
deploy:
replicas: 3
resources:
limits:
cpus: "0.5"
memory: 256M
restart_policy:
condition: on-failure
Let't say that I update the application and build a new image myimage:2.0
. What is a proper way to deploy the new version of image to the service without the downtime?
Upvotes: 5
Views: 3753
Reputation: 341
A way to achieve this is:
order
and parallelism
, for example if you choose order: stop-first
+ parallelism: 2
and your replicas are the same amount as parallelism
, your app will stop completely when updatingI have some examples on that subject:
With this you can simply run docker stack deploy...
again. If there was changes in the service, it will be updated.
Upvotes: 8
Reputation: 1781
you can use the command docker service update --image
but it will start a new container with a implicit scale 0/1.
The downtime depends of your application.
Upvotes: 2