I have searched around and found some similar questions, but no answer seemed to clarify completely.
Scenario: Newer images keep getting pushed to the concerned Docker registry. I want to use docker-compose to always pull the latest image from the registry and then replace the existing running container on the Docker host with a new container deployed from that latest image.
Is just executing 'docker-compose up -d' enough? Or do I need to do a 'docker-compose pull' or any other step before that?
The docker-compose pull command above pulls the latest versions of the images and then the docker-compose up -d command re-creates the containers from that images and starts them in a background.
The docker-compose spec says: pull_policy defines the decisions Compose implementations will make when it starts to pull images. always: always pull.
In this tutorial, you will use Watchtower with both Docker's run command and Docker Compose to automatically update a Docker image. Both methods are functionally the same in creating a container running Watchtower, then pointing it towards a container you wish to keep automatically updated.
You won't pull new service images just running this command:
docker-compose up -d
If you need to always check for a newer image and use it this command should work for you:
docker-compose pull && docker-compose up -d
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With