Watch latest image for container and update it automatically with notification
219
WatchContainer is an open‑source, lightweight container auto‑updater that monitors your running Docker containers and automatically updates them whenever a new version of their image is published on Docker Hub. It also supports optional Slack notifications for update events.
This project is similar to Watchtower but more focused, simpler, and supports per‑container configuration through Docker labels.
Clone this repo or pull the image directly:
docker pull openappstech/watchcontainer:latest
services:
newConn1:
image: openappstech/conn:latest
container_name: newConn1
ports:
- "8080:80"
labels:
io.watcher.enable: "true"
io.watcher.slack.enable: "true"
io.watcher.slack.webhook: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
io.watcher.slack.channel: "#channel-name"
restart: unless-stopped
watcher:
image: openappstech/watchcontainer:latest
container_name: watcher
volumes:
- /var/run/docker.sock:/var/run/docker.sock
# - /var/lib/docker:/var/lib/docker:ro # optional but useful for metadata
evironment:
GLOBAL_SLACK_WEBHOOK: "slack/xxxxxxx"
GLOBAL_SLACK_CHANNEL: "#channel-name"
WATCH_INTERVAL: "30"
CLEAN_OLD_IMAGE: "true"
restart: unless-stopped
Run the watcher using Docker Compose:
services:
watcher:
image: openappstech/watchcontainer:latest
container_name: watcher
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
GLOBAL_SLACK_WEBHOOK: ""
GLOBAL_SLACK_CHANNEL: ""
WATCH_INTERVAL: "30" # default: 10 sec
CLEAN_OLD_IMAGE: "true" # optional
restart: unless-stopped
The watcher will now automatically scan for containers that include io.watcher.enable=true.
latest tagWatchContainer currently checks for updates based on the latest tag. Make sure the containers you want to monitor are running images tagged as latest.
If you build a new image locally on the same server while WatchContainer is active, the following can happen:
When you rebuild an image with the same tag (latest), Docker temporarily un-tags the existing image.
During this untagged window, WatchContainer may detect:
This causes WatchContainer to pull incorrect layers and trigger an unnecessary update.
This scenario only happens when building images locally on the same host where WatchContainer is running.
➡️ In real production deployments, images should be built in CI/CD or a separate build server — not on the live Docker host.
Attach these labels to any container you want WatchContainer to manage.
| Label | Type | Description | Default |
|---|---|---|---|
io.watcher.enable | boolean | Enables watcher for this container | false |
io.watcher.slack.enable | boolean | Enables Slack notifications | false |
io.watcher.slack.webhook | string | Slack webhook (container-specific) | "" |
io.watcher.slack.channel | string | Slack channel (container-specific) | "" |
docker run -d \
--name newConn1 \
-p 8080:80 \
--label io.watcher.enable=true \
--label io.watcher.slack.enable=true \
--label io.watcher.slack.webhook="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
--label io.watcher.slack.channel="#channle-name" \
openappstech/conn:latest
io.watcher.enable=true → The watcher monitors this containerio.watcher.slack.enable=true → Enable Slack notificationsio.watcher.slack.webhook="..." → Slack webhook specific to this containerio.watcher.slack.channel="#channel" → Slack channel for this containerIf container-specific Slack settings are missing, the watcher falls back to global Slack settings.
| Variable | Description | Default |
|---|---|---|
GLOBAL_SLACK_WEBHOOK | Fallback Slack webhook | "" |
GLOBAL_SLACK_CHANNEL | Fallback Slack channel | "" |
WATCH_INTERVAL | Watch interval (seconds) | 10 |
CLEAN_OLD_IMAGE | Remove old images (true/false) | false |
Watcher sends Slack notifications when:
Notification priority:
io.watcher.slack.*)GLOBAL_SLACK_*)If CLEAN_OLD_IMAGE=true, WatchContainer will automatically remove old image versions after redeploying the updated container.
Content type
Image
Digest
sha256:b7b46e2a2…
Size
5.9 MB
Last updated
11 months ago
docker pull openappstech/watchcontainer