A lightweight “sidecar” Docker container that watches a primary container and enforces ad‑hoc “depends on” behaviour - if your monitored container goes offline, any listed dependents are stopped (and prevented from starting until it’s back up).
die / start) on your host’s daemon--restart policies| Environment Variable | Description | Default |
|---|---|---|
MONITOR | Name of the container to watch (exact match) | critical-container |
DEPENDANT | Space‑separated list of containers to stop if MONITOR is not running | dependent-one another-service more-containers |
GRACE | Seconds to wait after MONITOR dies before stopping DEPENDANT containers | 5 |
All other behaviour (listening to Docker events, parsing JSON) is built into the bundled monitor.sh.
docker run -d \
--name [container]-monitor \
-v /var/run/docker.sock:/var/run/docker.sock \
-e MONITOR="my-critical-container" \
-e DEPENDANT="worker-1 worker-2 ui-service" \
-e GRACE="10" \
--restart unless-stopped \
chrisjbawden/dependson:latest
-v /var/run/docker.sock:/var/run/docker.sock Grants the sidecar access to Docker events and CLI on the host.
-e MONITOR="…" Cofnigure which contained to monitor/watch
-e DEPENDANT="…" Configure which container/s to control in response to changes in the container being monitored.
--restart unless-stopped Ensures your watchdog will relaunch automatically if it crashes or the host reboots.
Development of this image can be found here - https://github.com/chrisjbawden/dependson
Content type
Image
Digest
sha256:6f4696aad…
Size
138.7 MB
Last updated
7 months ago
docker pull chrisjbawden/dependson