1.2.5 • Published 4 years ago

watchtower-docker v1.2.5

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

NPM Version NPM Downloads Docker Pulls

Watchtower

Watch Docker containers and check for image updates on Docker Hub. Watchtower can be used to monitor for updates or automatically update existing containers with the new image.

------------------------------------------------
watching 10 containers @ 06/09/2020 01:02:01 EDT
------------------------------------------------
2 updates found
grafana/grafana:latest | 3 hours ago
portainer/portainer:latest | 15 minutes ago
------------------------------------------------
downloading 2 images
grafana/grafana:latest
portainer/portainer:latest
downloads complete in 13.28 seconds
------------------------------------------------
recreating 2 containers
grafana
portainer
recreations complete in 4.57 seconds
------------------------------------------------
pruning images & volumes
2 images | 54.50 MB
0 volumes
pruning complete in 1.02 seconds
-----------------------------------------------
run complete in 19.46 seconds

Install

Node.js npm install watchtower-docker

Docker docker pull jakowenko/watchtower

Usage

Node.js

const watchtower = require('watchtower-docker');

watchtower.run();

Docker

docker run -d \
  --name=watchtower \
  -e WATCH_ALL=true \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  jakowenko/watchtower
version: '3.7'

services:
  watchtower:
    container_name: watchtower
    image: jakowenko/watchtower
    restart: unless-stopped
    environment:
      WATCH_ALL: 'true'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro

How are updates detected?

There are currently two ways Watchtower checks for image updates.

  • If the last_updated value on Docker Hub is newer than your containers createdAt value.
  • If the last_updated value on Docker Hub changes while Watchtower is running.
/* Docker Hub API v2 Sample Response Snippet */
{
	"last_updated": "2020-05-28T13:50:21.956701Z",
	"last_updater_username": "jakowenko",
	"name": "latest",
	"images": [{
		"architecture": "amd64",
		"features": "",
		"variant": null,
		"os": "linux",
		"os_features": "",
		"os_version": null,
		"size": 380405997
	}],
	"repository": 9138104,
	"full_size": 380405997,
	"v2": true
}

Setting a valid NOTIFY_TYPE will result in a notification if either of the above conditions are met.

If NOTIFY_TYPE is set to http then notifications will be POSTed to NOTIFY_HTTP_URL with the following payload:

{
	"title": "Watchtower",
	"text": "Sample notification message"
}

Options

Options are passed to Watchtower with environment variables or by using a .env file in the root directory of your project.

NameDefaultDescription
WATCH_ALLfalseWatch all running containers
AUTO_UPDATEfalseWhen an update is detected, Watchtower will pull the newest image and recreate the container with the same configuration
UPDATE_ON_STARTfalseAutomatically pull new images and recreate all containers when Watchtower starts
TIMER30Time in minutes before rechecking containers. If set to 0, Watchtower will only run once
DB_MEMORYtrueWhether to store the database in memory or on disk
PRUNE_IMAGESfalseRemove all unused images
PRUNE_VOLUMESfalseRemove all unused local volumes
TZUTCTimezone used in logs
TIME_FORMATMM/DD/YYYY hh:mm:ssFormat of time used in logging and notifications
TELEMETRYtruePass telemetry data to help improve Watchtower
IMAGESComma separated list of extra Docker Hub images to watch (cdr/code-server, esphome/esphome:dev)
NOTIFY_TYPEType of notification: http, email
NOTIFY_SUBJECTWatchtowerSubject value passed in notification
NOTIFY_HTTP_URLURL POST request is sent to for notifications
NOTIFY_EMAIL_HOSTSMTP server to send emails
NOTIFY_EMAIL_PORT587Port used to connect to the SMTP server
NOTIFY_EMAIL_USERNAMEUsername to authenticate with the SMTP server
NOTIFY_EMAIL_PASSWORDPassword to authenticate with the SMTP server
NOTIFY_EMAIL_FROM_NAMENotifySender name for the email notifications
NOTIFY_EMAIL_TOEmail address to which notifications will be sent

Labels

Labels can used to:

  • Include or exclude specific containers from being watched
  • Automatically pull the newest image and recreate the container when Watchtower starts

Enable

version: '3.7'

services:
  example:
    image: example/example-watch
    labels:
      - 'watchtower.enable=true'

Disable

version: '3.7'

services:
  example:
    image: example/example-dont-watch
    labels:
      - 'watchtower.enable=false'

Update on Start

version: '3.7'

services:
  example:
    image: example/example-watch
    labels:
      - 'watchtower.update-on-start=true'
1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.2.0-beta.6

4 years ago

1.2.0-beta.5

4 years ago

1.2.0-beta.4

4 years ago

1.2.0-beta.3

4 years ago

1.2.0-beta.2

4 years ago

1.2.0-beta.1

4 years ago

1.2.0-beta.0

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago