Things I've have learned: to use Watchtower to automate Docker image updates
·1 min
A while ago, I started using Docker images and docker-compose to setup my development environment, but also for the deployment of my sites and new projects I’m currently working on.
The only problem with this, specially in the deployment, is that whenever a new version of one of the Docker images is published, I need to update it manually.
It’s not very difficult, it involves pulling the updated image and stopping and restarting the docker-compose.
Then I saw this:
I’ve added Watchtower to my deployed projects like this:
watchtower:
command: --interval 300
container_name: watchtower
image: containrrr/watchtower:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
And it just works!
This will check every five minutes for new images, pull and restart them.
The Lifecycle hooks look very promising and I want to explore using them to run Django migrations.