#docker – Updating docker containers automatically with Watchtower. Bonus: let’s learn Go !

Buy Me A Coffee

Hi !

A couple of days ago, I wrote about how I like Portainer as a visual interface to manage docker (see references). In one of the comments, Marco suggested also an option to automatically update all my containers.

As I explained in my post, the basic steps for this are

  • docker stop
  • docker rm
  • docker pull
  • docker run

Super easy, but tedious if you need to do this several times. Let’s meet Watchover.

Watchtover has the ability to β€œwatch” running Docker containers on either the same local or remote host, check if there is a newer image in the remote registry, and then update the container with the new image using the same configuration options it was instantiated with.

I give this a try, and I found that it was very easy, just a command

docker run -d \
    --name watchtower \
    -v /var/run/docker.sock:/var/run/docker.sock \

And, there is a personal bonus here. I’ve been looking for an excuse to start to play around with Go, and this is the one. I think, I’ll use the excuse of update my containers as my next phase on Go learning.

Happy coding!


El Bruno

More posts in my blog ElBruno.com.


Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: