Automatic Docker Container Updates with Watchtower

If you use Docker on your server or Raspberry Pi, keeping your container images up to date can be repetitive and time-consuming. Fortunately, Watchtower automates this process by checking for new image versions and updating your containers for you — on a schedule you control.

In this guide, you’ll learn how to configure Watchtower to run once per week, every Thursday at 04:00, using a cron schedule inside a docker-compose.yml file.


⭐ Why Use Watchtower with a Weekly Schedule?

Daily automatic updates might work for some setups, but they also carry risks:

✔ Unexpected updates can break services
✔ Frequent updates may conflict with backups or maintenance windows
✔ Daily restarts may cause instability in production environments

A weekly update schedule is ideal for:

  • Low-traffic servers
  • Home labs
  • Environments where controlled maintenance is desired
  • Minimizing downtime while keeping containers up to date
AI-generated image

🛠 Example docker-compose.yml File (Copy & Paste)

Here’s a complete Docker Compose configuration that sets up Watchtower with a weekly update schedule every Thursday at 04:00:

version: "3.8"

services:
  watchtower:
    image: containrrr/watchtower
    container_name: watchtower
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - TZ=America/Sao_Paulo
      - WATCHTOWER_CLEANUP=true
    command: --schedule "0 4 * * 4"

What This Does

  • containrrr/watchtower — Official Watchtower image
  • restart: unless-stopped — Ensures Watchtower restarts automatically
  • volumes — Allows Watchtower to access the Docker daemon
  • WATCHTOWER_CLEANUP=true — Removes old images after updating
  • --schedule "0 4 * * 4" — Cron expression for Thursday at 04:00

🗓 Understanding the Cron Expression

The cron schedule used above consists of five fields:

FieldValueMeaning
Minute0At minute 0
Hour4At 04:00 AM
Day of Month*Any day
Month*Any month
Day of Week4Thursday

➡️ Result: Updates automatically every Thursday at 04:00.

AI-generated image

✅ How to Deploy Watchtower

  1. Save the Docker Compose file above as docker-compose.yml.
  2. Run:
docker compose up -d
  1. Verify it’s running:
docker ps | grep watchtower
  1. Check the logs to confirm the schedule:
docker logs watchtower

You should see output confirming Watchtower is running with the cron schedule.


🧪 How to Test Watchtower Manually

Want to force a check immediately without waiting for Thursday?

docker run --rm \
  -v /var/run/docker.sock:/var/run/docker.sock \
  containrrr/watchtower --run-once

This runs Watchtower once and checks for updates right away.

AI-generated image

❓ FAQ – Watchtower Scheduled Updates

Do I need to use the latest tag?
Yes — containers tagged with static versions (like :1.0.3) won’t update automatically unless they use latest.

Will Watchtower restart my containers?
Yes — Watchtower only restarts containers when a new image is found.

Can automatic updates break my service?
Yes, unexpected changes can cause breakages, which is why a weekly schedule is recommended over daily updates.

Does Watchtower clean up old images?
Yes — with WATCHTOWER_CLEANUP=true, old images are removed after an update.


🏁 Conclusion

Setting up Watchtower with a weekly schedule gives you a professional and controlled automatic update workflow for Docker containers. By updating containers once per week every Thursday at 04:00, you balance automation with stability — ideal for homelabs, light production servers, and self-hosted environments.


Want to master Docker in homelab environments?
Check out all Docker & Containers tutorials →

Leave a Comment

Your email address will not be published. Required fields are marked *


Scroll to Top