Watchtower

Watchtower

Watchtower

  • You can support more guides like this Click to Donate
  • Version
  • Create Date June 20, 2024
  • Last Updated June 20, 2024
  • Installation Support Ask Support
  • Number of views
    N/A

A container-based solution for automating Docker container base image updates

About: https://containrrr.dev/watchtower

In this guide i will show how to install Watchtower using Portainer and Docker.

With watchtower you can update the running version of your containerized app simply by pushing a new image to the Docker Hub or your own image registry. Watchtower will pull down your new image, gracefully shut down your existing container and restart it with the same options that were used when it was deployed initially.

If you already have docker and portainer installed, and you know your user id and group id, skip to Step 4

Follow this guide to install docker: How to install docker

Follow this guide to install portainer: How to install portainer

Find your current time zone on this website, as example for Brussels is:

TZ=Europe/Brussels

Open Portainer by typing in your web browser http://yournasip:19000

After you login on Portainer, go to Home, then click on your Local Environment

Go to Stacks and click on Add stack

On the name type watchtower, select Web editor and paste the code below.

restart: you can choose from alwaysunless-stopped, or on-failure[:number of retries]

version: "3.9"
services:
    watchtower:
        container_name: watchtower
        environment:
          - TZ=Europe/Brussels
          - WATCHTOWER_CLEANUP=true # remove the old image after restarting a container with a new image
          - WATCHTOWER_REMOVE_VOLUMES=true # Removes anonymous volumes after updating
          - WATCHTOWER_INCLUDE_RESTARTING=true # restarting containers
          - WATCHTOWER_INCLUDE_STOPPED=false # if change to true, exited containers will also be monitored
          - WATCHTOWER_POLL_INTERVAL=86400 # poll interval, default to 24 hours
          - WATCHTOWER_DISABLE_CONTAINERS=tailscale-ugreen portainer # exclude some container from being monitored
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock
        image: containrrr/watchtower
        restart: unless-stopped

Scroll down and click on Deploy the stack.

If everything goes well, you will get a message that the stack was successfully deployed.

You will see now the container running

Watchtower doesn't have any web interface. In order to see it's activities, check the logfile by pressing on the small button on the container line

Now you can see watchtower activity and the first check will be done in 24 hours.

User Reviews
You are not allowed to post review.
Posted in .