Files
Nicolas De Loof 76df8709cc poc: capture hook output, surface it with compose logs --hooks
Lifecycle hooks are execs: their output only existed for the attached
listener, and post-hoc inspection was impossible — the engine's logging
driver never sees exec output. With CaptureLogs, hook execs now tee
their output into the container's logging driver, stamped with the
compose identity labels (project, service, and the new
com.docker.compose.hook label carrying post_start or pre_stop).

compose logs gains a --hooks flag: it requests the log details, tells
hook-stamped lines apart from the container's own output, and labels
them with the hook type (e.g. "db [post_start] | ..."). No client-side
state is involved: the log stream itself carries the attribution, so
any client can retrieve hook output for a project it did not create.

Daemons whose API predates CaptureLogs ignore the capture fields, and
without --hooks the logs output is unchanged: the PoC degrades
gracefully in both directions.
2026-08-19 14:44:52 +02:00
..