Connect with us

Hi, what are you looking for?

Docker

Keep Docker containers up to date with Watchtower

What is Watchtower?

The purpose of Watchtower is to keep all or select Docker containers up to date at all times without requiring user intervention. Watchtower will also perform cleanup of the images which are replaced so that they will not take up unnecessary space. When an updated container image is found it will be pulled, shutdown, and restarted with the same configuration.

What arguments can be configured?

Watchtower contains many different arguments like configuring notifications when containers are updated or filtering of containers. There is a nice list of arguments and the docker-compose environment variable with examples in their documentation.

Example Docker-Compose

    watchtower:
        image: containrrr/watchtower:latest
        container_name: watchtower
        environment:
          WATCHTOWER_NOTIFICATIONS: email
          WATCHTOWER_NOTIFICATION_EMAIL_FROM: from@gmail.com
          WATCHTOWER_NOTIFICATION_EMAIL_TO: to@gmail.com
          WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER: admin@gmail.com
          WATCHTOWER_NOTIFICATION_EMAIL_SERVER: mail.domain.com
          WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD: password
          WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT: 26
          WATCHTOWER_POLL_INTERVAL: 28800
          WATCHTOWER_CLEANUP: "true"
          WATCHTOWER_NOTIFICATION_EMAIL_DELAY: 2
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock
        restart: always

Conclusion

I’ve been using Watchtower for over a month now and I haven’t had any major issues with it. I only had an issue with one container which depended on another container and for some reason would never start up properly after Watchtower updated and attempted to restart it. I’ve since replaced that container and haven’t had any other issues. If a setup where minimal interaction is desired and keeping all Docker containers up to date is a goal then I recommend Watchtower.

Click to comment

Leave a Reply

Your email address will not be published.

You May Also Like

Docker

Setting up NGINX with a free Let’s Encrypt SSL certificate is a breeze using Docker and the container maintained by Linuxserver.io. The default setup...

Plex

Plex updated it’s support of collections at the end of 2017 by letting the user choose to group movies in a collection ie. Star...

Linux

Configure the TP-Link AX50 router so that it can be shared between both Windows and Linux. The router has USB sharing built into the...

Technology

Cloudflare has plenty to offer even to free users. I looked into some methods of improving the TTL or time to first byte as...

Copyright © 2021 Carl Peterson. Theme by MVP Themes, powered by WordPress.