We deploy our application using docker-compose files with version 3 and docker swarm.

Setting up

Making sure that overlay2 driver is used (which is recommended):

docker info | grep 'Storage Driver'

If it does not return anything, then you have to configure overlay2 driver by yourself.

Creating a single file for deployment:

docker-compose -f docker-compose.yml -f docker/ config > docker-compose.deploy.yml

Activating swarm mode (this command should be run only once per host):

docker swarm init


To actually deploy a software run:

docker stack deploy --compose-file docker-compose.deploy.yml my-app-name

Updating already running service

If you need to update an already running service, them you will have to use docker service update or docker stack deploy.

Updating existing service. Updating existing stack.

Zero-Time Updates

Zero-Time Updates can be tricky. You need to create containers with the new code, update existing services, wait for the working sessions to be completed, and to shut down old containers.

You can do it with swarm’s Rolling updates.

Further readings