Important or Recent Updates
Historic Updates | Date |
---|---|
New guide update for DSM7.2 and Container Manager | 30/04/2023 |
Added labels to GlueTUN container guide so updated information in this one to coincide | 06/05/2023 |
Added a 3rd option to just exclude specific containers via a label. | 23/11/2023 |
What is Watchtower?
Watchtower monitors and automatically updates your containers to the latest versions for you, it is useful as it is not limited to which Docker repositories it can pull from. The Container Manager UI can only notify you of updates for container images from Docker Hub, not the popular GitHub.
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.
/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:
Section | Setting |
---|---|
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.
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
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)
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.
Variable | Value | What it does |
---|---|---|
TZ | Europe/London | Change this to your own timezone |
WATCHTOWER_CLEANUP | true or false | We 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 | true or false | Do you want to update any stopped containers, the container will stay stopped after being updated (true or false) |
WATCHTOWER_REVIVE_STOPPED | true or false | If 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 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 🙂
Looking for some help, join our Discord community
If you are struggling with any steps in the guides or looking to branch out into other containers join our Discord community!
Buy me a beverage!
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 stay hydrated. Plus 10% goes to the devs of the apps I do guides for every year.
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!!!
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.
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!
I added an exclusion to the Gluetun container back in May as it always breaks the connection between the containers if you allow Watchtower to update Gluetun. Its OK for Watchtower to update the containers connected through it though. Essentially if you want to update Gluetun you have to do it manually and then trigger a Project Rebuild by following this guide.
https://drfrankenstein.co.uk/2023/04/25/updating-containers-in-container-manager/
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
Hey
Just to confirm is Plex running in Docker?
If it is, yes Watchtower can update it for you.
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.
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?
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.
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?
Hey – What time/frequency are you trying to put in place FRI is not a valid schedule for the Cron.
Misread your comment, to set your variables use this format
https://paste.drfrankenstein.co.uk/?950be1b3bab46fd9#HhX9w6pHjhETvxtvSBtwNcbrQNzC41UPd6rucHvJcguh
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
Can you try quoting the schedule
WATCHTOWER_SCHEDULE: “0 5 * * FRI”
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.
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
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…
Looks like it was in the works
https://github.com/containrrr/watchtower/pull/1208