Reputation: 7505
We have a multi-container application, which uses a microservices architecture, running in Docker Compose.
When I make code changes to the web app, for example, I need to rebuild the image with new code, then run it again in my compose stack, without any downtime.
Here is the current sequence of events that we are using:
docker-compose down
docker-compose up
After running docker-compose down
, all apps go down. Then docker-compose up
brings the whole stack back up.
Is there a way to redeploy individual images in Docker Compose without any downtime, and without bringing down the entire application stack?
Upvotes: 7
Views: 3302
Reputation: 36773
You can avoid to put down everything at the same time (docker-compose down
), just with something like this:
docker-compose pull --parallel
docker-compose up --force-recreate <specific-service-name1>
This will pull & stop & recreate (run) your <specific-service-name1>
containers, and won't touch any other container.
Later you can deploy the rest:
docker-compose up --force-recreate <specific-service-name2>
docker-compose up --force-recreate <specific-service-name3>
Upvotes: 6