Skip to content

Watchtower – Automated Updates in Container Manager on a Synology NAS

Important or Recent Updates
Historic UpdatesDate
New guide update for DSM7.2 and Container Manager30/04/2023
Added labels to GlueTUN container guide so updated information in this one to coincide06/05/2023
Added a 3rd option to just exclude specific containers via a label.23/11/2023
Historic Updates


What is Watchtower?

Watchtower requires access to the Docker socket, we are unable to set this up via the Synology GUI. This means we will be using Docker-Compose.

Let’s Begin

We will be setting up Watchtower using the Project functionality in Container Manager. This uses a compose file to tell Docker how to set up the container and also define some preferences.

Folder Setup

Let’s start by getting a folder set up for the container to use. Open up File Station create the following.

Folders
/docker/projects/watchtower-compose


Container Manager

Next we are going to set up a ‘Project’ in Container Manager. Open up Container Manager and click on Project then on the right-hand side click ‘Create’.

In the next screen we will set up our General Settings, enter the following:

SectionSetting
Project Name:watchtower
Path:/docker/projects/watchtower-compose
Source:Create docker-compose.yml

We have a couple of different composes available below, the first one is configured to update all running containers at 2am daily.

YAML
services:
  watchtower:
    image: containrrr/watchtower:latest
    container_name: watchtower
    environment:
      - TZ=YOURTIMEZONE
      - WATCHTOWER_CLEANUP=true
      - WATCHTOWER_INCLUDE_STOPPED=true
      - WATCHTOWER_REVIVE_STOPPED=false
      - WATCHTOWER_SCHEDULE=0 0 2 * * *
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    restart: unless-stopped

As an addition to the method above you can exclude specific containers from updates by adding this line to their yaml (compose) details. This is likely faster than using method 2

YAML
    labels:
      - com.centurylinklabs.watchtower.enable=false

The second has an added section where you can specify the names of the containers you would like to update (use the exact name of the container as per the Synology UI)

YAML
services:
  watchtower:
    image: containrrr/watchtower:latest
    container_name: watchtower
    environment:
      - TZ=YOURTIMEZONE
      - WATCHTOWER_CLEANUP=true
      - WATCHTOWER_INCLUDE_STOPPED=true
      - WATCHTOWER_REVIVE_STOPPED=false
      - WATCHTOWER_SCHEDULE=0 0 2 * * *
    command: # add or remove the below as required
      - overseerr
      - plex
      - prowlarr
      - radarr
      - sonarr
      - tautulli
      - watchtower
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    restart: unless-stopped

You can copy and paste the one you wish to use into the blank section in Container Manager.

Environment Variables

We need to make some changes in order for watchtower to know what time it is where you are and what we want it to do. You can amend these in the compose based on your preferences.

VariableValueWhat it does
TZEurope/LondonChange this to your own timezone
WATCHTOWER_CLEANUPtrue or falseWe want to clean up the old docker images, if you don’t turn this on over the course of a few months you will find that the images start to eat a lot of space, and they are not even being used. (true or false)
WATCHTOWER_INCLUDE_STOPPEDtrue or falseDo you want to update any stopped containers, the container will stay stopped after being updated (true or false)
WATCHTOWER_REVIVE_STOPPEDtrue or falseIf a stopped container is updated do you want Watchtower to start it up? (true or false)
WATCHTOWER_SCHEDULE0 0 2 * * *Rather than setting the number of seconds to wait between checks you can set a schedule. The default I use for the guide is 2am every day, you can work out your own schedule using a cron schedule generator.

Click ‘Next’

You do not need to enable anything on the ‘Web portal settings’ screen click ‘Next’ again

On the final screen click Done which will begin the download of the container images and once downloaded they will be launched!

The image will now be downloaded and extracted. You should see ‘Code 0’ when it has finished.

You will now see your watchtower project running it should have a green status on the left-hand side.

You can now just leave Watchtower running you will never need to manually update your containers again.

FAQ

I keep getting X container has stopped unexpectedly errors!
DSM does not know or understand that Watchtower is issuing commands in the background. So it makes the assumption that a container was stopped unexpectedly, but we know it was Watchtower doing an update.

Do I need to update Watchtower itself?
Nope it updates itself – quite clever really 🙂



Buy Me a Coffee or a Beer

If you have found my site useful please consider pinging me a tip as it helps cover the cost of running things or just lets me get the odd beverage. Plus 10% goes to the devs of the apps I do guides for every year.

Published inDockerSynologyUpdating Containers 7.2

30 Comments

  1. Sladester Sladester

    Rather than listing the containers I want to update, is there a way to list the ones I do NOT want to update? I’d rather they all auto-update, and only have 1 or 2 I would prefer to do manually. Thanks!!!

    • Dr_Frankenstein Dr_Frankenstein

      Hey love the question as it always triggers the ‘oh yeah I should include another way’ 🙂

      We can add labels to containers which are built via Projects to exclude them.. This is already in place on the GlueTUN container in the VPN guides. Give me 30 mins I will update the guide with the extra method.

  2. Peter Peter

    When I use watchtower to update, the containers that are dependant on gluetun doesn’t start even though gluetun seems to be running. Any way to fix this? And thank you for some great guides!

      • Karim Karim

        Hi there, I setup my box fully with your guide a long time ago, thanks btw.
        I’m not thinking to add Plex to my docker environment to keep it updated, rather than relearning all this which is quite complex for me is there a way to simply add Plex to be watched in the watchtower docker container?
        Thanks

        • Dr_Frankenstein Dr_Frankenstein

          Hey

          Just to confirm is Plex running in Docker?

          If it is, yes Watchtower can update it for you.

  3. Slowfinger Slowfinger

    For anyone using TorGuard VPN and running into a GlueTun error and/or QBitTorrent not seeing the tun0 interface), check your error logs.

    I had to add OPENVPN_CIPHERS as an additional environmental variable to my .yaml file. to fix the error (the error log provided the information I needed to add).

    Example:

    environment:
    – VPN_SERVICE_PROVIDER=torguard
    – VPN_TYPE=openvpn
    – OPENVPN_USER=myusername
    – OPENVPN_PASSWORD=mypassword
    – OPENVPN_CIPHERS=AES-128-CBC
    – SERVER_COUNTRIES=USA
    – TZ=America/Los_Angeles

    After doing this, gluetun displayed a green light and qbittorrent recognized the tun0 network interface.

  4. Symphonic Symphonic

    I just noticed something strange. After watchtower did its updates today, my gluetun and qbittorrent containers still show “Update available” in the Container Manager.
    I can tell qbittorrent was apparently updated because the Web UI shows version 4.5.3 which seems to be the latest.
    I’m not sure how to verify gluetun’s version but in the log I found the following line:
    [vpn] You are running 5 commits behind the most recent latest

    Did watchtower not grab the latest versions or what’s going on here? Is Container Manager offering me updates to nightly versions?

    • Dr_Frankenstein Dr_Frankenstein

      Hey – it will depend on how often container manager is checking for updates – I am not on DSM7.2 yet on my production machine so will keep an eye on this when I update. As for Gluetun in the most recent version of the guide you will see I added a Label to exclude it from auto updates as it will generally break the stack of containers. You probably dodged a string of dodgy releases over the last 2 weeks as had quite a lot of people with broken setups due to bugs. You can pull the latest release in Container Manager and then within the Project do a Rebuild from the menu this will bring you up to date. I will get this as an extra section on the Container Manager updates guide.

  5. Symphonic Symphonic

    Hi,
    I’m having an issue getting the schedule variable to work which seems to break the whole container.
    I used the cron schedule generator you linked to create a weekly schedule to run every friday at 5:00 am. According to the generator I have to use: 0 5 * * FRI
    So the whole line looks like this:
    – WATCHTOWER_SCHEDULE=0 5 * * FRI

    The watchtower container is now starting and stopping constantly and the log is being filled with the following error:
    level=error msg=”Failed to parse int from FRI: strconv.Atoi: parsing \”FRI\”: invalid syntax”

    It looks like I can’t use FRI for the day? How am I supposed to set the day?

    • Dr_Frankenstein Dr_Frankenstein

      Hey – What time/frequency are you trying to put in place FRI is not a valid schedule for the Cron.

      • Symphonic Symphonic

        I just tried it and it’s still giving me the exact same error.
        This is the full compose:

        services:
        watchtower:
        image: containrrr/watchtower:latest
        container_name: watchtower
        environment:
        TZ: Europe/Berlin
        WATCHTOWER_CLEANUP: true
        WATCHTOWER_INCLUDE_STOPPED: true
        WATCHTOWER_REVIVE_STOPPED: false
        WATCHTOWER_SCHEDULE: 0 5 * * FRI
        volumes:
        – /var/run/docker.sock:/var/run/docker.sock
        network_mode: synobridge
        restart: unless-stopped

        • Dr_Frankenstein Dr_Frankenstein

          Can you try quoting the schedule
          WATCHTOWER_SCHEDULE: “0 5 * * FRI”

          • Symphonic Symphonic

            Nope, same thing.
            I also tried using different days like MON or TUE. Nothing works :/
            I wouldn’t mind not having any day at all and just running it on a weekly basis but I’m not sure how to set that up.

            • Dr_Frankenstein Dr_Frankenstein

              OK figured it out this is 5am every Friday, you can put the variable back to the original format again for this.

              0 0 5 * * 5

          • Symphonic Symphonic

            Your solution worked! Thanks a lot! 🙂

            I have one more question. Is it possible to set up a delay of set amount of days from the time a new update was released?
            An example to explain what I mean: Let’s say I want a delay of 5 days. The Plex container had an update released on Tuesday. Watchtower runs on Friday as per schedule, sees there was a Plex update, adds 5 days from Tuesday so it installs the update on Sunday.
            This would add a bit of headroom in case a new update breaks something. If that makes sense…

Leave a Reply

Your email address will not be published. Required fields are marked *

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

drfrankenstein.co.uk – writing Synology Docker Guides since 2016 – Join My Discord!