Sign inSign up

zachbg/config-reload

By zachbg

•Updated 6 months ago

Watch config files and auto-reload containers on changes via signal or restart

Image
1

1.6K

zachbg/config-reload repository overview

⁠Config Reload

Watch config files and automatically reload your containers when they change. No more manual docker restart after editing nginx.conf, Caddyfile, or any config.

⁠Why?

You edit a config file. Nothing happens. You docker restart. Your users get downtime. Config-reload watches your config files and gracefully reloads the container — zero downtime, zero manual effort.

⁠Quick Start

services:
  config-reload:
    image: zachbg/config-reload:latest
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./nginx.conf:/watch/nginx.conf:ro
    environment:
      RELOAD_CONTAINER: nginx
      RELOAD_SIGNAL: HUP

  nginx:
    image: nginx
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro

⁠Environment Variables

VariableDefaultDescription
RELOAD_CONTAINERrequiredContainer name or label:key=value
WATCH_DIR/watchDirectory to watch for changes
RELOAD_ACTIONsignalsignal, restart, or exec
RELOAD_SIGNALHUPSignal to send (for signal action)
RELOAD_CMDnginx -s reloadCommand to run (for exec action)
DEBOUNCE2Seconds to debounce rapid changes
WATCH_PATTERNComma-separated file extensions to watch (e.g., .conf,.yml)
WEBHOOK_URLNotification webhook URL

⁠Reload Actions

⁠Signal (graceful reload)
environment:
  RELOAD_CONTAINER: nginx
  RELOAD_ACTION: signal
  RELOAD_SIGNAL: HUP

Best for: nginx, HAProxy, Apache, Prometheus

⁠Exec (run command inside container)
environment:
  RELOAD_CONTAINER: nginx
  RELOAD_ACTION: exec
  RELOAD_CMD: "nginx -s reload"

Best for: Services with specific reload commands

⁠Restart (full restart)
environment:
  RELOAD_CONTAINER: myapp
  RELOAD_ACTION: restart

Best for: Apps without graceful reload support

⁠Examples

⁠Nginx config reload
services:
  config-reload:
    image: zachbg/config-reload:latest
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./nginx:/watch:ro
    environment:
      RELOAD_CONTAINER: nginx
      RELOAD_SIGNAL: HUP
      WATCH_PATTERN: ".conf"
⁠Traefik dynamic config
services:
  config-reload:
    image: zachbg/config-reload:latest
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./traefik/dynamic:/watch:ro
    environment:
      RELOAD_CONTAINER: traefik
      RELOAD_ACTION: restart
      WATCH_PATTERN: ".yml,.yaml,.toml"
⁠Target by label
services:
  config-reload:
    image: zachbg/config-reload:latest
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./config:/watch:ro
    environment:
      RELOAD_CONTAINER: "label:app=webserver"
      RELOAD_ACTION: signal
      RELOAD_SIGNAL: HUP

Tag summary

Content type

Image

Digest

sha256:6e49924f3…

Size

16.7 MB

Last updated

6 months ago

docker pull zachbg/config-reload