Tool Spotlight: Watchtower
Watchtower helps you use the most recent Docker images.
What is it for?
Basically, an automated way to do very simple continuous deployment.
Watchtower repeatedly asks the Docker registry whether one more more Docker tags point to a new image. If a newer image exists, Watchtower pulls it and restarts the corresponding containers.
You can use it for all containers on a machine, or only for some of them.
You might be interested if…
You are running a containerized non-production environment which you want to keep updated.
Sometimes there’s a new image version with the same image name and tag.
Usually you’d need to remove the old image, pull the new one and restart the containers by hand.
Instead, you’d like that to happen automatically. A slight delay is okay. You don’t mind automatic unattended updates, and nobody will mind an accidental downtime.
What you need to know
- Open source.
- Very simple to setup.
- Able to keep itself updated.
You can …
- Run it in a Docker container.
- Make sure oyur containers use new images.
- Run it for all containers on the machine or limit it to a few container names.
- Specify the interval at which Watchtower checks for image changes.
- Label single containers to exclude them from what Watchtowers does.
- Send out email and Slack notifications when there’re updates.
Take a look
The GitHub project README goes into more details.
Simply run it on your local machine, and give it a spin. I wouldn’t suggest to use it in an important production environment, but it’s fine for a simple testing setup.
Creating an automated deployment script for your containerized application is somewhat similar, but not quite. You’d need to trigger it somehow, or run it manually.
If you’re only working with images which you’re building yourself, you could create a deployment pipeline, which takes care of redeploying your application after pushing a new image to the repository.