Does docker swarm mode start replicas simultaneously or wait until each one finishes? Does docker swarm mode start replicas simultaneously or wait until each one finishes? docker docker

Does docker swarm mode start replicas simultaneously or wait until each one finishes?


By default docker swarm create the replicas at same time, but update one replica at time (rolling update). As far as I know, you can't control the creation but you can create an application with one replica and then update it:

docker service create --replicas 1 --name apache httpd:alpinesleep 60 # one minutedocker service update --replicas 2 apachesleep 60 # one more minute ...docker service update --replicas 3 apache

This is safe because the existing replica is untouched if you don't change any parameter other then --replicas.

If you want to update the replicas one at time you can use --update-parallelism, and go even further controlling the time between each update replica with --update-delay:

docker service update apache \--image nginx:alpine \--update-parallelism 1 \--update-delay 10s