5UBZERO664 Logo
Back to Blog
February 22, 2026

Update your containers easily. Install Watchtower using Portainer.

Automate updates to your containerized apps on Docker by installing Watchtower.https://www.facebook.com/profile.php?id=100088075450661https://www.instagram.c...

Alright, buckle up, tech enthusiasts! Today, we're diving into the world of containerized applications and how to keep them up-to-date with minimal fuss. Specifically, we're going to explore Watchtower, a nifty tool that automates Docker container updates. And to make things even smoother, we'll see how to install it using Portainer. This blog post will walk you through the process, step by step, so you can wave goodbye to manual container updates.

Understanding the Need for Automated Container Updates

Before we get our hands dirty, let's address why we even need automated container updates. Imagine you're running several applications in Docker containers on your Raspberry Pi or a server. Each container has a base image, and these images often get updates with bug fixes, security patches, and new features.

Manually updating each container every time a new image version is released can be a tedious and time-consuming task, especially if you have many containers. Plus, you have to do it manually to keep the Docker containers secure. That's where Watchtower comes in!

What is Watchtower?

Watchtower is a containerized app that watches over your other Docker containers. When it detects that a new image for one of your containers is available, it automatically pulls the new image, shuts down the old container gracefully, and starts a new container with the updated image. This all happens behind the scenes without requiring any manual intervention from you.

Think of Watchtower as a vigilant guardian constantly monitoring the Docker Hub or your own image registry for newer versions of your container images. When it spots an update, it swoops in and upgrades your containers.

Why use Portainer?

Portainer is a web-based GUI allowing you to manage and maintain your docker containers. We will use it to install Watchtower to make it more user friendly.

Installing Watchtower via Portainer Stacks

Installing Watchtower is a breeze using Portainer's Stacks feature. Here's how you do it:

  1. Access Portainer: Log in to your Portainer instance.
  2. Navigate to Stacks: In the left sidebar, click on the "Stacks" menu item.
  3. Add a New Stack: Click on the "+ Add stack" button.
  4. Name Your Stack: Give your stack a descriptive name, such as "watchtower."
  5. Paste Docker Compose Content: In the "Web editor" section, paste the following Docker Compose configuration.
version: "3"
services:
  watchtower:
    image: containrrr/watchtower
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - WATCHTOWER_CLEANUP=true
      - WATCHTOWER_LABEL_ENABLE=true
      - WATCHTOWER_INCLUDE_STOPPED=true
      - WATCHTOWER_REVIVE_STOPPED=true
      - WATCHTOWER_POLL_INTERVAL=3600

Replace the contents of the Docker Compose editor with this.

Configuration Details Explained

Let's look at the Docker Compose file.

  • version: "3": Specifies the version of the Docker Compose file format.
  • services: Defines the services that make up the stack.
  • watchtower: Defines the Watchtower service.
  • image: Specifies the Docker image to use for Watchtower. In this case, it's the official containrrr/watchtower image from Docker Hub.
  • volumes: Defines the volumes to mount into the container. We're mounting the Docker socket (/var/run/docker.sock) to allow Watchtower to communicate with the Docker daemon and monitor containers.
  • environment: Defines environment variables for Watchtower:
    • WATCHTOWER_CLEANUP=true: Removes old images after updating.
    • WATCHTOWER_LABEL_ENABLE=true: Allows Watchtower to update containers based on labels.
    • WATCHTOWER_INCLUDE_STOPPED=true: Includes stopped containers in the update process.
    • WATCHTOWER_REVIVE_STOPPED=true: Restarts stopped containers after updating.
    • WATCHTOWER_POLL_INTERVAL=3600: Sets the interval (in seconds) at which Watchtower checks for updates. Here, it's set to 3600 seconds (1 hour).

Optional Environment Variables:

  • Debug Mode:
    • If more verbose logging is needed, add WATCHTOWER_DEBUG=true. This will add additional logging information.
  • Cleanup:
    • If you need to clean the old Docker images from the container after updates, use WATCHTOWER_CLEANUP=true.
  • Email Notifications:
    • Email notifications can be set up, but is outside the scope of the current article.
  1. Deploy the Stack: Scroll down and click on the "Deploy the stack" button.

Portainer will now pull the Watchtower image and create the container based on the configuration you provided. You can monitor the deployment process in the Portainer interface.

Verifying the Installation

Once the stack is deployed successfully, you can verify that Watchtower is running correctly by following these steps:

  1. Navigate to Containers: In the left sidebar, click on the "Containers" menu item.
  2. Check Watchtower Status: You should see a container named something like "watchtower-watchtower-1" with a status of "running."
  3. View Logs: Click on the Watchtower container and then click on the "Logs" tab.

In the logs, you should see Watchtower initializing and scheduling its first check for updates in 24 hours. It should look similar to this.

time="2023-06-30T06:58:54Z" level=info msg="Scheduling first run: 2023-07-01 06:58:54 +0000 UTC"
time="2023-06-30T06:58:54Z" level=info msg="Note that the first check will be performed in 23 hours, 59 minutes, 59 seconds"

Customizing Watchtower's Behavior (Optional)

The Docker Compose configuration we used provides some basic settings for Watchtower. However, you can customize its behavior further by adding more environment variables. Here are a few examples:

  • WATCHTOWER_POLL_INTERVAL: Changes the interval at which Watchtower checks for updates. The number is represented in seconds.
  • WATCHTOWER_INCLUDE_STOPPED: Tells Watchtower to also update stopped containers.

For a complete list of available environment variables, refer to the Watchtower documentation.

Key Takeaways

  • Watchtower automates the process of updating Docker containers, saving you time and effort.
  • It monitors Docker Hub or your own registry for new image versions.
  • Watchtower pulls the new image, shuts down the old container, and starts a new one with the updated image.
  • You can customize Watchtower's behavior using environment variables.

Resources

Automating container updates with Watchtower is a smart move for anyone running containerized applications. It ensures that your applications are always up-to-date with the latest security patches and features, all without requiring constant manual intervention. So, give it a try and enjoy the peace of mind that comes with automated container updates!