How to Install Watchtower on Your UGREEN NAS

How to Install Watchtower on Your UGREEN NAS

Watchtower is a Docker application that monitors your running containers for changes to the image. When an update is available in the Docker registry, Watchtower detects the changes and pulls down the new copy of the image. It will then restart the container using the new image and the same start options of the original, without you losing any data. In this step by step guide I will show you how to install Watchtower on your UGREEN NAS using Docker & Portainer.⚠️Warning: Watchtower will do upgrades of your docker containers automatically. This means that, if a docker image has a bug, it might destroy some containers you already have installed. For this reason, it is vital that you make Backups of your Docker folders.

💡Note: This guide works perfectly with the latest Watchtower v1.7.1 release.

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install Portainer using my step by step guide. If you already have Portainer installed on your UGREEN NAS, skip this STEP.

  • STEP 3

Log into Portainer using your username and password. On the left sidebar in Portainer, click on Stacks then + Add stack. Follow the instructions in the image below.

UGREEN NAS Portainer Add Stack

  • STEP 4

In the Name field type in watchtower. Follow the instructions in the image below.

Note: Copy Paste the code below in the Portainer Stacks Web editor.

version: "3.9"
services:
  watchtower:
    image: containrrr/watchtower:latest
    container_name: WATCHTOWER
    hostname: watchtower
    mem_limit: 512m
    mem_reservation: 128m
    cpu_shares: 512
    security_opt:
      - no-new-privileges=true
    read_only: true
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      TZ: Europe/Bucharest
      WATCHTOWER_CLEANUP: true # Remove old images after updating
      WATCHTOWER_REMOVE_VOLUMES: false # Remove attached volumes after updating
      DOCKER_API_VERSION: 1.45 # SSH docker version 1.41 for Docker engine version 20.10 - 1.43 for Docker engine version 24 - 1.45 for Docker engine version 26.1
      WATCHTOWER_INCLUDE_RESTARTING: true # Restart containers after update
      WATCHTOWER_INCLUDE_STOPPED: false # Update stopped containers
      WATCHTOWER_SCHEDULE: "0 0 */2 * * *" # Update & Scan containers every 2 hours
      WATCHTOWER_LABEL_ENABLE: false
      WATCHTOWER_ROLLING_RESTART: true
      WATCHTOWER_TIMEOUT: 30s
      WATCHTOWER_LOG_FORMAT: pretty
    restart: on-failure:5

Note: Before you paste the code above in the Web editor area below, change the value for TZ (Select your current Time Zone from this list).
Note: Before you paste the code above in the Web editor area below, change the value for DOCKER_API_VERSION. 1.41 is for Docker engine 20.10 – 1.43 is for Docker engine 24 – 1.45 for Docker engine 26.1. Check the exact version on the official Docker engine API website or check the following screenshot to find it in Portainer.
Note: If you want, you can change some parameters in the code above such as the frequency with which your containers get scanned and updated.

Watchtower UGREEN NAS Set up 1

  • STEP 5

Scroll down on the page until you see a button named Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.

Watchtower UGREEN NAS Set up 2

  • STEP 6

If everything goes right, you will see the following message at the top right of your screen: “Success Stack successfully deployed“.

Watchtower UGREEN NAS Set up 3

Enjoy Watchtower!

💡Note: Watchtower does not have a graphical interface. To see which container was updated, you can check the logs for the Watchtower container. On the Portainer left sidebar, click Containers, then click the little log icon on the WATCHTOWER container.

NAS Check Watchtower logs 1

After you click on the little log icon, you can see which container has been updated.

NAS Check Watchtower logs 2

This post was updated on Sunday / July 7th, 2024 at 5:52 PM