Docker cross-stack dependency waiter in Go
632
Docker cross-stack dependency waiter in Go. Project layout follows golang-standards/project-layout: main.go (entrypoint), cmd/dogowaiter (command), internal/dogowaiter (app logic), build/package (Docker).
Run the image (mount the Docker socket; the container needs it to talk to the daemon):
docker run --rm -it \
-v /var/run/docker.sock:/var/run/docker.sock \
dogowaiter [options]
See Usage for CLI flags and env vars.
Example compose.yaml with all env vars:
services:
dogowaiter:
image: ghcr.io/nekrich/dogowaiter:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./config.yaml:/config/dogowaiter.yaml:ro # optional, for --config
environment:
DOGOWAITER_CONFIG_FILE: /config/dogowaiter.yaml # optional; or use DOGOWAITER_DEPENDENCIES
DOGOWAITER_DEPENDENCIES: "mystack:web,api" # optional; used when no config file
DOGOWAITER_HEALTH_FILE: /tmp/healthy # optional;
DOGOWAITER_DOCKER_HOST: unix:///var/run/docker.sock # optional
DOGOWAITER_LOG_LEVEL: info # optional
# Or use DOCKER_HOST / LOG_LEVEL instead of DOGOWAITER_* where supported
CLI flags and env vars (flags override env). At least one of --config / DOGOWAITER_CONFIG_FILE or --dependencies / DOGOWAITER_DEPENDENCIES is required.
| Flag | Env | Description |
|---|---|---|
--config | DOGOWAITER_CONFIG_FILE | Path to YAML file with a depends_on list. If empty, DOGOWAITER_DEPENDENCIES is used instead. When set, the file is watched (resolved path, 30s debounce); changes are picked up automatically without restart. If the file is removed, the process resolves the path once more and exits with error status if it no longer exists. Default: config/dogowaiter.yaml. |
--dependencies | DOGOWAITER_DEPENDENCIES | Comma-separated list of dependencies. Each entry is stack:service or service (stack omitted). Examples: stack1:web,stack2:api, web,api, service (empty stack). Used when config file is not set. |
--docker-host | DOGOWAITER_DOCKER_HOST, DOCKER_HOST | Docker API endpoint. Default: unix:///var/run/docker.sock. For docker-socket-proxy or remote Docker, set to e.g. tcp://docker-socket-proxy:2375. |
--log-level | DOGOWAITER_LOG_LEVEL, LOG_LEVEL | Log level: debug, info, or error. Default: info. |
DOGOWAITER_HEALTH_FILE | Path for the JSON health file. Default: /tmp/healthy. |
When using DOGOWAITER_CONFIG_FILE, the file can contain:
docker_host: tcp://sock:2375 # optional
log_level: debug # optional
depends_on:
- name: myservice
stack: mystack # optional; empty = any stack. Match by com.docker.compose.project label.
- otherservice # scalar = service name only (any stack)
Containers are matched by label com.docker.compose.project (when stack is set) and com.docker.compose.service or by container name.
Content type
Image
Digest
sha256:399a9eabd…
Size
9.6 MB
Last updated
7 months ago
docker pull nekrich/dogowaiter