Watchtower - Docker NAS Setup
Tags: docker, nas, tutorial, technology
Published: 2021-02-19 19:01:07

---
title: Watchtower - Docker NAS Setup
published: true
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2nxqfydu6lctd6shw2ki.png
date: 02/19/2021
tags: docker,nas,tutorial,technology
canonical_url: https://chrisotto.dev/watchtower-docker-nas/
series: Synology NAS Setup
---

Image courteous of [@kristsll on Unsplash](https://unsplash.com/@kristsll).

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.

## [<svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg>](#prerequisites-)Prerequisites 📃

- Enable SSH for your NAS
  - If you don’t have SSH enabled follow this [guide](https://dev.to/chrisotto/synology-nas-ssh-to-find-user-info-396a)

## [<svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg>](#ssh-into-your-nas-)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%
```

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

```
%USERNAME%@%SYNOLOGY_NAS_NAME%:~$
```

## [<svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg>](#run-the-container-)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
```

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](https://dev.to/chrisotto/portainer-docker-container-manager-for-your-nas-1130).
- 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! 🍻