Open torarnv opened 1 day ago
For your use-case, we could introduce:
watch:
- path: ./webapp/html
action: sync+exec
target: /var/www
exec: <command to run in container by docker exec ...>
note: A comparable use-case could require to send a signal to container, typically SIGHUP to force a reset/reconfiguration of the service. Container's entrypoint could catch such a signal to run a custom command
An explicit exec
would work, good idea!
Container's entrypoint could catch such a signal to run a custom command
I think a requirement for such a feature is that the container doesn't need any modification, ie custom entrypoint, to be able to be "watchable" by docker compose.
But yes, if the container already reacts to e.g. SIGHUP
, then the exec
part could be a signal. How would the exec
know which process to signal? I guess it's the only one running in the container?
sure, this was just a note about a comparable feature request, not a XOR statement
Description
Sometimes the container supports explicit reloads of the config. E.g. Caddy can do
caddy reload --config /etc/caddy/Caddyfile
In this mode the container doesn't need to be restarted, it's enough to do sync+reload (not sync+restart).
Would be nice if there was a
sync+reload
mode where a custom reload command could be provided.Not having to restart the container would mitigate issues like https://github.com/docker/compose/issues/12317