Recreate Containers with No Downtime in Docker-Compose

dockerdocker-compose

I am using docker-compose for deploying several containers on the same host. My images are built in Google Cloud Build and stored on gcr.io; I am not using docker-compose to build my images.

When I run docker-compose pull followed by docker-compose up -d, new containers are created for my images. However, if I run docker ps in another tab, I observe that my containers go offline for a few seconds while the new ones are being created.

Is there a way to tell docker-compose to recreate and then restart the containers without any downtime?

Best Answer

docker-compose up by itself does not support any way of deploying with zero downtime.

https://docs.docker.com/compose/reference/up/

You'll need to implement your own blue/green deployment or have a look at kubernetes's rolling update: https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/

Related Topic