Watchtower — automatické aktualizácie Docker kontajnerov

Raz nastavíš, navždy zabudneš. Watchtower každú noc skontroluje či existuje nová verzia tvojich kontajnerov a ak áno, ticho ich aktualizuje — v čase ktorý ty určíš, nie keď práve pozeráš film.

Docker kontajnery sa neaktualizujú samy. Každý deň vychádza tucet aktualizácií — bezpečnostné záplaty, opravy bugov, nové funkcie. Bez automatizácie ich budeš riešiť raz za tri mesiace keď si na to náhodou spomenieš. Watchtower to rieši elegantne: jeden kontajner, ktorý sleduje ostatné a robí aktualizácie za teba.

Prečo automatické aktualizácie

Dôvody sú dva a oba sú rovnako dôležité. Bezpečnosť — neaktualizované kontajnery sú najčastejší vstupný bod útočníkov v homelab prostredí. Zraniteľnosti v závislých knižniciach, base image vrstvách alebo samotnej aplikácii sú reálne. Nové funkcie — Plex, AdGuard, Vaultwarden vydávajú aktualizácie pravidelne. Watchtower zabezpečí, že máš vždy poslednú verziu bez toho aby si musel čokoľvek robiť manuálne.

⚠️ Problém s aktualizáciami vo zlý čas

Štandardne Watchtower kontroluje každých 24 hodín od spustenia — čo môže byť o 20:00 keď pozeráš film cez Plex. Nastavenie CRON plánu na 3:00 ráno tento problém úplne eliminuje.

1. Docker Compose stack

Základná inštalácia — Watchtower beží, kontroluje každú noc o 3:00 a zmaže staré images po aktualizácii:

services:
  watchtower:
    image: containrrr/watchtower:latest
    container_name: watchtower
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - TZ=Europe/Bratislava
      - WATCHTOWER_SCHEDULE=0 0 3 * * *
      - WATCHTOWER_CLEANUP=true
      - WATCHTOWER_INCLUDE_RESTARTING=true
Čo jednotlivé premenné robia

WATCHTOWER_SCHEDULE — CRON výraz kedy sa má kontrolovať. WATCHTOWER_CLEANUP=true — zmaže staré Docker images po aktualizácii (šetrí miesto na disku). WATCHTOWER_INCLUDE_RESTARTING=true — aktualizuje aj kontajnery ktoré sa práve reštartujú.

2. Nastavenie času — CRON formát

Watchtower používa 6-miestny cron výraz: sekundy minúty hodiny deň mesiac deň-týždňa.

Chceš vypočítať správny cron čas?

Použi Cron Kalkulačku — zadaj ľubovoľný výraz a okamžite uvidíš kedy presne sa spustí, rozklad každého poľa aj zoznam nasledujúcich behov.

CRON výrazPopis
0 0 3 * * *Každú noc o 3:00 — odporúčané
0 0 4 * * 1Každý pondelok o 4:00
0 30 2 * * 0,6Každú sobotu a nedeľu o 2:30
0 0 2 1 * *Prvý deň každého mesiaca o 2:00

3. Vynechanie kontajnerov

Nie každý kontajner chceš aktualizovať automaticky — napríklad ak potrebuješ špecifickú verziu alebo chceš aktualizácie testovať manuálne. Máš dve možnosti.

Cez label (per-kontajner)

Pridaj label priamo do compose súboru kontajnera ktorý chceš vynechať:

services:
  plex:
    image: ghcr.io/linuxserver/plex:latest
    container_name: PlexHW
    labels:
      - "com.centurylinklabs.watchtower.enable=false"
    # ... ostatné nastavenia

Cez premennú (zoznam)

Ak chceš vynechať viacero kontajnerov naraz, pridaj do Watchtower stack:

environment:
  - WATCHTOWER_DISABLE_CONTAINERS=plex,adguardhome,vaultwarden

4. Emailové notifikácie (voliteľné)

Watchtower môže posielať email keď aktualizuje kontajnery. Odporúčam Gmail s App Password — rovnaký postup ako pri Vaultwarden SMTP nastavení.

environment:
  - WATCHTOWER_NOTIFICATIONS=email
  - WATCHTOWER_NOTIFICATION_EMAIL_FROM=tvoj@gmail.com
  - WATCHTOWER_NOTIFICATION_EMAIL_TO=tvoj@gmail.com
  - WATCHTOWER_NOTIFICATION_EMAIL_SERVER=smtp.gmail.com
  - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT=587
  - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER=tvoj@gmail.com
  - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=xxxx-xxxx-xxxx-xxxx
Gmail App Password

Na myaccount.google.com/apppasswords vygeneruj App Password pre „Mail". Výsledný 16-znakový kód vlož do WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD. Tvoje hlavné heslo Gmail nikam nevkladáš.

5. Ďalšie užitočné nastavenia

PremennáPopis
WATCHTOWER_MONITOR_ONLY=trueLen sleduje zmeny a posiela notifikácie — neaktualizuje. Vhodné ak chceš kontrolu pred aktualizáciou.
WATCHTOWER_ROLLING_RESTART=trueAktualizuje kontajnery jeden po druhom — minimalizuje downtime pri väčšom počte kontajnerov.
WATCHTOWER_INCLUDE_STOPPED=trueAktualizuje aj zastavené kontajnery (nie len bežiace).
WATCHTOWER_NO_STARTUP_MESSAGE=trueZakáže uvítaciu notifikáciu pri štarte Watchtower.

6. Overenie inštalácie

Po nasadení stacku over, že Watchtower beží a naplánoval prvý beh:

docker logs watchtower

Správny výstup vyzerá takto:

time="..." level=info msg="Watchtower 1.x.x"
time="..." level=info msg="Using no notifications"
time="..." level=info msg="Scheduling first run: 2026-04-24 03:00:00"
time="..." level=info msg="Note that the first check will be performed in X hours"
Záver

Inštalácia na 2 minúty, výhoda permanentná

Watchtower je jeden z kontajnerov kde návratnosť investície je okamžitá. Nastavíš čas na 3:00 ráno, zapneš cleanup a od tej chvíle máš vždy aktuálny homelab — bez prerušenia Plexu, bez manuálnej práce. Pri kritických kontajneroch ako Vaultwarden alebo AdGuard Home odporúčam pridať label watchtower.enable=false a aktualizovať ich manuálne po overení.

Watchtower — automatische Docker Container Updates

Einmal einrichten, für immer vergessen. Watchtower prüft jede Nacht ob neue Container-Versionen verfügbar sind und aktualisiert sie automatisch — zu einem Zeitpunkt, den du selbst bestimmst.

Docker-Container aktualisieren sich nicht von selbst. Täglich erscheinen Sicherheitspatches, Fehlerbehebungen und neue Funktionen. Watchtower löst das elegant: ein Container, der alle anderen überwacht und Updates automatisch durchführt.

Warum automatische Updates

Es gibt zwei gleichwertige Gründe. Sicherheit — veraltete Container sind der häufigste Angriffspunkt in Homelab-Umgebungen. Neue Funktionen — Plex, AdGuard, Vaultwarden veröffentlichen regelmäßig Updates. Watchtower stellt sicher, dass du immer die neueste Version hast.

⚠️ Updates zur falschen Zeit

Standardmäßig prüft Watchtower alle 24 Stunden ab dem Start — was z.B. um 20:00 Uhr sein kann, wenn du gerade Plex schaust. Ein CRON-Zeitplan auf 3:00 Uhr nachts löst dieses Problem vollständig.

1. Docker Compose Stack

services:
  watchtower:
    image: containrrr/watchtower:latest
    container_name: watchtower
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - TZ=Europe/Berlin
      - WATCHTOWER_SCHEDULE=0 0 3 * * *
      - WATCHTOWER_CLEANUP=true
      - WATCHTOWER_INCLUDE_RESTARTING=true

2. CRON-Zeitplan

Watchtower verwendet einen 6-stelligen Cron-Ausdruck: Sekunden Minuten Stunden Tag Monat Wochentag.

CRON-AusdruckBeschreibung
0 0 3 * * *Jeden Abend um 3:00 Uhr — empfohlen
0 0 4 * * 1Jeden Montag um 4:00 Uhr
0 30 2 * * 0,6Samstag und Sonntag um 2:30 Uhr
Richtigen Cron-Ausdruck berechnen?

Nutze den Cron-Rechner — gib einen beliebigen Ausdruck ein und sieh sofort wann er läuft, die Feldaufschlüsselung und die nächsten Ausführungszeiten.

3. Container ausschließen

Per Label

labels:
  - "com.centurylinklabs.watchtower.enable=false"

Per Umgebungsvariable

environment:
  - WATCHTOWER_DISABLE_CONTAINERS=plex,adguardhome,vaultwarden

4. E-Mail-Benachrichtigungen (optional)

environment:
  - WATCHTOWER_NOTIFICATIONS=email
  - WATCHTOWER_NOTIFICATION_EMAIL_FROM=deine@gmail.com
  - WATCHTOWER_NOTIFICATION_EMAIL_TO=deine@gmail.com
  - WATCHTOWER_NOTIFICATION_EMAIL_SERVER=smtp.gmail.com
  - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT=587
  - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER=deine@gmail.com
  - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=xxxx-xxxx-xxxx-xxxx

5. Weitere nützliche Einstellungen

VariableBeschreibung
WATCHTOWER_MONITOR_ONLY=trueNur überwachen und benachrichtigen — keine Updates durchführen.
WATCHTOWER_ROLLING_RESTART=trueContainer nacheinander aktualisieren — minimiert Ausfallzeiten.
WATCHTOWER_INCLUDE_STOPPED=trueAuch gestoppte Container aktualisieren.
WATCHTOWER_NO_STARTUP_MESSAGE=trueKeine Benachrichtigung beim Start von Watchtower.

6. Installation prüfen

docker logs watchtower
Fazit

2 Minuten Installation, dauerhafter Nutzen

Watchtower gehört zu den Containern mit dem besten Aufwand-Nutzen-Verhältnis. Zeit auf 3:00 Uhr setzen, Cleanup aktivieren — und ab sofort läuft dein Homelab immer aktuell. Für kritische Container wie Vaultwarden oder AdGuard empfehle ich das Label watchtower.enable=false und manuelle Updates nach vorherigem Test.

Watchtower — automatic Docker container updates

Set it once, forget it forever. Watchtower checks every night for new container versions and updates them automatically — at a time you choose, not when you're watching a movie.

Docker containers don't update themselves. Security patches, bug fixes and new features ship daily. Without automation you'll deal with them once every few months when you happen to remember. Watchtower solves this elegantly: one container that monitors all others and handles updates for you.

Why automatic updates

Two equally important reasons. Security — outdated containers are the most common attack vector in homelab environments. New features — Plex, AdGuard, Vaultwarden release updates regularly. Watchtower ensures you always have the latest version without doing anything manually.

⚠️ Updates at the wrong time

By default Watchtower checks every 24 hours from startup — which could be 8pm when you're watching Plex. Setting a CRON schedule to 3am completely eliminates this problem.

1. Docker Compose stack

services:
  watchtower:
    image: containrrr/watchtower:latest
    container_name: watchtower
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - TZ=Europe/London
      - WATCHTOWER_SCHEDULE=0 0 3 * * *
      - WATCHTOWER_CLEANUP=true
      - WATCHTOWER_INCLUDE_RESTARTING=true

2. CRON schedule

Watchtower uses a 6-field cron expression: seconds minutes hours day month weekday.

CRON expressionDescription
0 0 3 * * *Every night at 3am — recommended
0 0 4 * * 1Every Monday at 4am
0 30 2 * * 0,6Saturday and Sunday at 2:30am
Want to calculate the right cron time?

Use the Cron Calculator — enter any expression and instantly see when it runs, the field breakdown and the next scheduled runs.

3. Excluding containers

Per container label

labels:
  - "com.centurylinklabs.watchtower.enable=false"

Via environment variable

environment:
  - WATCHTOWER_DISABLE_CONTAINERS=plex,adguardhome,vaultwarden

4. Email notifications (optional)

environment:
  - WATCHTOWER_NOTIFICATIONS=email
  - WATCHTOWER_NOTIFICATION_EMAIL_FROM=your@gmail.com
  - WATCHTOWER_NOTIFICATION_EMAIL_TO=your@gmail.com
  - WATCHTOWER_NOTIFICATION_EMAIL_SERVER=smtp.gmail.com
  - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT=587
  - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER=your@gmail.com
  - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=xxxx-xxxx-xxxx-xxxx

5. Additional useful settings

VariableDescription
WATCHTOWER_MONITOR_ONLY=trueMonitor only and notify — do not update containers.
WATCHTOWER_ROLLING_RESTART=trueUpdate containers one at a time — minimizes downtime.
WATCHTOWER_INCLUDE_STOPPED=trueAlso update stopped containers.
WATCHTOWER_NO_STARTUP_MESSAGE=trueDisable the startup notification when Watchtower starts.

6. Verify installation

docker logs watchtower
Verdict

2 minute install, permanent benefit

Watchtower is one of those containers where the return on investment is immediate. Set the schedule to 3am, enable cleanup — and your homelab stays up to date automatically. For critical containers like Vaultwarden or AdGuard Home, add the watchtower.enable=false label and update them manually after testing.