how to get docker-compose to use the latest image from repository
in order to make sure, that you are using the latest version for your :latest
tag from your registry (e.g. docker hub) you need to also pull the latest tag again. in case it changed, the diff will be downloaded and started when you docker-compose up
again.
so this would be the way to go:
docker-compose stop
docker-compose rm -f
docker-compose pull
docker-compose up -d
i glued this into an image that i run to start docker-compose and make sure images stay up-to-date: https://hub.docker.com/r/stephanlindauer/docker-compose-updater/
To get the latest images use docker-compose build --pull
I use below command which is really 3 in 1
docker-compose down && docker-compose build --pull && docker-compose up -d
This command will stop the services, pulls the latest image and then starts the services.