DEV Community

Cover image for Watchtower - Docker NAS Setup
Chris Otto
Chris Otto

Posted on • Originally published at chrisotto.dev on

Watchtower - Docker NAS Setup

Image courteous of @kristsll on Unsplash.

Watchtower is a container that will update all your other running containers when a new version is published to the Docker registry that they are set up through. This is helpful for your Docker containers to stay up to date on your home server or NAS. If you would like to install on on your home server and not through a NAS you can jump down to the running the container portion.

Prerequisites πŸ“ƒ

  • Enable SSH for your NAS
    • If you don’t have SSH enabled follow this guide

SSH Into Your NAS πŸ’»

Now that SSH is enabled on our NAS we need to SSH into the machine so that we can run the docker run command. Open up the terminal on your machine and enter the following:

ssh %USERNAME%@%IP_ADDRESS% -p %PORT%
Enter fullscreen mode Exit fullscreen mode

After you enter in your password you should be greeted with:

%USERNAME%@%SYNOLOGY_NAS_NAME%:~$
Enter fullscreen mode Exit fullscreen mode

Run the Container 🐳

In your terminal enter the following docker run command:

sudo docker run --name="watchtower" -d --restart=always -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower:latest
Enter fullscreen mode Exit fullscreen mode

This will run Watchtower on your NAS allowing it to update existing running images whenever there is a new version pushed! That’s it for the main portion of getting Watchtower up and running. Here a few extra notes since I’ve been running it for a few months:

  • I highly recommend getting Portainer set up to maintain the old images that get replaced, I have a guide on how to set that up here.
  • If you want to exclude certain images from being updated you can stop them and rerun them with a label of com.centurylinklabs.watchtower.enable=false

Happy containerization! Cheers! 🍻

Top comments (0)