Docker Community Forums

Share and learn in the Docker community.

Docker-Compose Theory


(Jmovingsoftware) #1

Hello Docker forum!

We use docker-compose pretty heavily, with 2 main “service” containers and then multiple “code” containers that are all linked.

Our main goal is, when we have an update to make, to just stop one of the code containers and bring up an updated container in its place. Without having to stop or restart any of the service containers since they would still be serving content from the other code containers that we didnt need to update.

This would allow us to have a history of containers/code on our repository, so if an update goes sideways we can just bring up the older container version and go on with our lives.

The issue is that when we try this, the service containers arent seeing any of the new code and are instead still seeing old code even though its deleted off the server. If I do docker exec -it code-container-new bash the new code is there, but if I was to do docker exec -it php-service bash then it still has the old code.

Wondering if this is intended, a bug, or if there is a better solution?


(Jmovingsoftware) #2

Wondering if this is intended, a bug, or if there is a better solution?


(David Maze) #3

If you rebuild your “code” container with a new version label, change the label in your docker-compose.yml, and re-run docker-compose up, it should destroy and recreate the container based on the new image. Is this not the behavior you’re seeing?