Docker Compose and Update

I use docker-compose to manage my standalone docker host(s). It is a convenient way to configure multiple containers and the docker-compose.yaml can be version controlled, which is also nice if you keep changing and experimenting with it. After you have created a docker-compose.yaml file all it takes is a:

$ docker-compose up -d

To get the stuff up and running. If an image does not exist it gets pulled from its source, but if an image is already on the system it gets reused! So for instance if you have:

services:
  myapp:
    image: my/container:latest

in your docker-compose.yaml it will not get updated on the host if the my/container:latest is updated, as the name already exists on the host. There are some workflows possible to work around with this:

If you are certain the new container is working and has no issues in the upgrade you can simply do:

$ docker-compose pull my/container:latest && docker-compose up -d 

I've been playing with multiple stage docker-compose.yaml files to make the building of the images