⛵️ Automate with Watchtower

Automate the deployment of the blog with Watchtower.

Nil

docker

Infrastructure

177 Words Reading Time: 48 Seconds

10-11-2024 18:44 +0000


Auto update blog with Watchtower

For some time now, I’ve been working on automating this blog as much as possible. I’ve started by automating the build and image upload with Github Actions, then created my own registry and now I’m going to automate the deployment of the blog with Watchtower. The process is quite simple, you just have to run a containrrr/watchtower pointing to the running instance of the blog. This container will check for new images in the registry and update the running container if a new image is found.

Running Watchtower

The only necessary command to run Watchtower is the following:

docker run -d \
  --name watchtower \
  -v /var/run/docker.sock:/var/run/docker.sock \
  containrrr/watchtower \
  pops-blog \
  --interval 30 \
  --cleanup

This command will run Watchtower in the background, checking for new images every 30 seconds and cleaning up old images after updating the running container.

What’s next?

Now, there are some containers in my VPS that I don’t know much about… I think I’ll start by checking them out and automating them as well. Stay tuned!