Skip to content

Watchtower — Automated Docker Updates on a Synology NAS

UpdateDate
New guide released31/12/2021

Watchtower is an application that watches for updates for all your over containers and automatically updates them for you, this saves you time especially when you have a lot of containers running.

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.

Docker Compose

We will be using Docker Compose to set up the container. In a nutshell we will be creating a text file (YAML formatted) which tells Docker exactly how we want to set up a specific container.

The next steps can be done either using a code/text editor such as Notepad++ or to keep things simple for this guide we will be using the Synology Text Editor which can be installed from the Package Center.

Install Text Editor from the Package Center

Open up Text Editor and click on File then New to start a new file.

You can now copy and paste the details below into the new text file, it is important you don’t change the spacing as YAML has to be formatted correctly in order to be read by Docker Compose.

version: "3.2"
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

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 based on your preferences.

VariableWhat it does
TZ=Europe/LondonChange this to your own timezone
WATCHTOWER_CLEANUP=trueWe 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_STOPPED=trueDo you want to update any stopped containers, the container will stay stopped after being updated (true or false)
WATCHTOWER_REVIVE_STOPPED=falseIf a stopped container is updated do you want Watchtower to start it up? (true or false)
WATCHTOWER_SCHEDULE=0 0 2 * * *Rather than setting the number of seconds to wait between checks you can set a schedule. The default I use is to check at 2am everyday, you can work out your own schedule using a cron schedule generator

Your final file should look similar to the one shown below.

The final file

Saving the Compose File

We now need to save this file into our docker share

Click on File then Save As, navigate to the ‘Docker’ share and create a new folder called ‘watchtower’ (lower case)

You need to change the ‘File name’ to watchtower.yml and save it in the ‘watchtower’ folder

SSH and Docker-Compose

It’s time to get logged into you Diskstation via SSH, you can do this in the same way as when you obtained your IDs in the ‘Setting up a restricted Docker user‘ guide.

Once you have logged in you will need to give 2 commands, you can copy and paste these one at a time — you will need to enter your password for the command starting with ‘sudo’

First we are going to change directory to where the watchtower.yml is located, type the below and then press enter.

cd /volume1/docker/watchtower

Then we are going to instruct Docker Compose to read the file we created and complete the set-up the container. Again type the below and press enter.

sudo docker-compose -f watchtower.yml up -d

When the command has completed you should be able to see Watchtower running in the list of containers in the Synology GUI. You can go into the container and within the log you should see that Watchtower is counting down to your next check.

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

Throw me some bits or buy me a coffee?

If you have found my site useful please consider pinging me a tip as it helps cover the cost of running the site, you can even buy me a coffee 🙂

Buy Me A Coffee
  • Bitcoin
  • Ethereum
  • Tether
  • Cardano
  • Polkadot
  • Binance coin
  • Litecoin
  • Bitcoin cash
  • Dogecoin
  • Monero
  • Omisego
Scan to Donate Bitcoin to bc1qfq8ccs2yar7aa60fye8wdpanwtvpqzvrys4h6u

Donate Bitcoin to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin

Tag/Note:- Donations
Scan to Donate Ethereum to 0x7C5A441a6Dd520a796442DC6DeFeFE88d79D95f3

Donate Ethereum to this address

Scan the QR code or copy the address below into your wallet to send some Ethereum

Scan to Donate Tether to 0x7C5A441a6Dd520a796442DC6DeFeFE88d79D95f3

Donate Tether to this address

Scan the QR code or copy the address below into your wallet to send some Tether

Scan to Donate Cardano to addr1qysaldwdyqu9u8y9a0l5d35sqv202xr4768se8wevlexatepm76u6gpctcwgt6llgmrfqqc575v8ta50pjwajeljd6hsa6ggvv

Donate Cardano to this address

Scan the QR code or copy the address below into your wallet to send some Cardano

Scan to Donate Polkadot to 14R7Xr3587UKYsnnLhvBd7YfVgXkW9i3FU4kHP8DocsdLSha

Donate Polkadot to this address

Scan the QR code or copy the address below into your wallet to send some Polkadot

Scan to Donate Binance coin to bnb14ye5rju74u5ythneaum2rjvp8eqep6wq8flghx

Donate Binance coin to this address

Scan the QR code or copy the address below into your wallet to send some Binance coin

Scan to Donate Litecoin to LfNfer3aSqLx4p8KfbbkT96ArXLXLDPxoD

Donate Litecoin to this address

Scan the QR code or copy the address below into your wallet to send some Litecoin

Scan to Donate Bitcoin cash to qqz9pgaxdz4mtdxqxnlk7apqmsn6qzw9j5pn5jpvrc

Donate Bitcoin cash to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin cash

Scan to Donate Dogecoin to DCwbNzfYHx22MDSyEVLWgfjxziYHtcgwAM

Donate Dogecoin to this address

Scan the QR code or copy the address below into your wallet to send some Dogecoin

Scan to Donate Monero to 45qwFr42XiA8egC5z2HdSQ2FzzP9VR1MvD5Sicg4EhGvdvTutx9GsF6DeU8DHAsTZy2ShBERjCB5rdy8iQ9CFnFu9Z6Adgw

Donate Monero to this address

Scan the QR code or copy the address below into your wallet to send some Monero

Scan to Donate Omisego to 0x162fc7781D3C6c6f27197A3A92567b5DAF258f19

Donate Omisego to this address

Scan the QR code or copy the address below into your wallet to send some Omisego

Published inDockerSynologyUpdating Containers

4 Comments

  1. NewToSyn NewToSyn

    Loving your guides! I have just ordered a synology NAS and will be following them and sending some coffee. Started drafting the docker compose file in preparation. I was trying to figure out how to set watchtower to only update certain containers – their seems to be an environment variable to do this, but I believe I need to set it for each container. I don’t suppose you have done this?

    • Dr_Frankenstein Dr_Frankenstein

      Hey, shout out in Discord if you have any questions when setting up. I have not done what you are after but it looks easy. You add a label of ‘com.centurylinklabs.watchtower.enable’ to you other containers in the compose file and then the Environment Variable WATCHTOWER_LABEL_ENABLE this will then only update those containers.

      Bit hard to explain in the comments.

      • NewToSyn NewToSyn

        Thanks. Will give it a go, think I’ve figured out the label thing. Looks like an even simpler alternative is putting the names of the containers that I want monitored as part of the compose. Just out of interest – do you run your box with separate compose files, or a single one including all? I am unsure whether it’s critical to specify the version or not since some compose files seem to specify use of a different version at the start eg 2 vs 3

        • Dr_Frankenstein Dr_Frankenstein

          I use a single compose file in the /docker share. The version numbers don’t really make any difference to be honest at some point I used 3 and it just stuck. So there might be some slightly different numbers across the guides.

Leave a Reply

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