compose/pkg/compose
Deniss Solnce f8ed846e4d fix(hooks): include hook output in the error when a hook fails
A failing service hook returns only its exit code:

    dependency failed to start: db hook exited with status 1

The output that explains why is not there, and for a hook running without a
listener it does not exist anywhere: runHook created the exec with
AttachStdout/AttachStderr false, so the daemon discarded both streams and
runWaitExec only polled for the exit code. There was nothing left to look at
afterwards.

Now stdout and stderr are always attached, and the last lines of them are kept
in a bounded buffer. On non-zero exit that tail goes into the error:

    db hook exited with status 1: SQLSTATE[42S02]: Base table or view not found

A successful hook is unchanged - output goes to the listener as before, nothing
is added anywhere. With a listener the lines still stream out, the buffer just
tees them.

The buffer keeps the last 10 lines and 2 KiB, drops the oldest content and never
short-writes, so a chatty hook cannot block on it and cannot grow it.

runWaitExec is removed: it existed only for the unattached branch, and that
branch is what threw the output away.

Signed-off-by: Deniss Solnce <dennis.lapchenko@gmail.com>
2026-08-19 15:08:25 +02:00
..
testdata publish env_file references as opaque hash to prevent paths conflicts 2025-10-22 19:32:16 +02:00
transform Bump compose go to v2.10.0 2025-12-01 17:19:40 +01:00
api_versions.go fix: gate extra EndpointsConfig behind API >= 1.44 2026-03-31 15:44:00 +02:00
apiSocket.go Introduce abstractions to support SDK usage without requiring Docker CLI 2025-10-27 16:17:50 +01:00
attach.go chore: inline needless single-use helpers 2026-08-14 22:49:53 +02:00
attach_service.go golangci-lint: use gci formatter instead of goimports 2025-12-01 12:21:50 +01:00
build.go fix: address image-identity review findings 2026-08-13 12:03:29 +02:00
build_bake.go fix: bake target names collision for services differing by '.' vs '_' 2026-08-18 11:41:00 +02:00
build_bake_test.go fix: bake target names collision for services differing by '.' vs '_' 2026-08-18 11:41:00 +02:00
build_classic.go refactor: split doBuildImage context preparation stages 2026-08-18 13:37:48 +02:00
build_test.go fix(build): canonical content-digest producer, single image-label writer 2026-08-13 12:03:29 +02:00
commit.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
compose.go refactor: merge RuntimeVersion and CurrentAPIVersion into RuntimeAPIVersion 2026-03-31 14:39:37 +02:00
container.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
containers.go pre_start: support pre_start lifecycle hooks 2026-06-30 10:49:04 +02:00
convergence.go refactor: one function per depends_on condition in waitDependencies 2026-08-18 13:37:48 +02:00
convergence_test.go fix(reconcile): preserve zero-replica services during hashing 2026-07-16 15:19:50 +02:00
convert.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
cp.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
create.go refactor: extract endpoint and volume translation decisions in create 2026-08-18 13:37:48 +02:00
create_test.go fix: gate extra EndpointsConfig behind API >= 1.44 2026-03-31 15:44:00 +02:00
dependencies.go refactor(compose): remove redundant wrapper funcs in dependencies.go 2026-05-12 11:31:40 +02:00
dependencies_test.go fix mixed assertion libraries in tests 2026-03-31 17:32:51 +02:00
desktop.go refactor: drop Desktop beta-settings check; gate hint on LogsTab flag 2026-05-18 17:28:03 +02:00
docker_cli_providers.go Introduce abstractions to support SDK usage without requiring Docker CLI 2025-10-27 16:17:50 +01:00
down.go lint: replace gocyclo with gocognit 2026-08-18 10:42:37 +02:00
down_test.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
envresolver.go
envresolver_test.go
events.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
exec.go chore: inline needless single-use helpers 2026-08-14 22:49:53 +02:00
executor.go executor: split into ops + events files 2026-06-08 20:14:38 +02:00
executor_events.go executor: split into ops + events files 2026-06-08 20:14:38 +02:00
executor_ops.go feat(reconcile): best-effort old-network removal on rename 2026-07-27 14:56:25 +02:00
executor_test.go refactor(reconcile): aggregate observed resources, resolve conflicts in reconcile 2026-07-27 14:56:25 +02:00
export.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
filters.go nit: use labelFilter consistently in filters.go 2026-05-12 11:31:40 +02:00
generate.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
hash.go fix(reconcile): preserve zero-replica services during hashing 2026-07-16 15:19:50 +02:00
hash_test.go
hook.go fix(hooks): include hook output in the error when a hook fails 2026-08-19 15:08:25 +02:00
hook_test.go fix(hooks): include hook output in the error when a hook fails 2026-08-19 15:08:25 +02:00
image_pruner.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
images.go fix(images): tolerate containers whose image record is gone 2026-08-14 15:20:37 +02:00
images_test.go fix(images): tolerate containers whose image record is gone 2026-08-14 15:20:37 +02:00
kill.go refactor(compose): extract forEachContainerConcurrent to deduplicate pause/kill logic 2026-05-12 11:31:40 +02:00
kill_test.go refactor: fix lint issues from cleanup changes 2026-05-12 11:31:40 +02:00
loader.go restore support for COMPOSE_COMPATIBILITY 2025-12-07 18:42:04 +01:00
loader_test.go fix mixed assertion libraries in tests 2026-03-31 17:32:51 +02:00
logs.go refactor: flatten Ps, restart and Logs orchestration 2026-08-18 13:37:48 +02:00
logs_test.go refactor: fix lint issues from cleanup changes 2026-05-12 11:31:40 +02:00
ls.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
ls_test.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
model.go use new moby/moby modules instead of docker/docker dependency 2026-04-08 08:50:50 +02:00
monitor.go docs: document engine container event sequences in up monitor 2026-08-19 13:46:30 +02:00
monitor_test.go refactor: one handler per container event in monitor.Start, add tests 2026-08-18 13:37:48 +02:00
observed_state.go fix(build): resolve image volumes to a mountable name, not a manifest digest 2026-08-13 12:03:29 +02:00
observed_state_test.go fix(build): canonical content-digest producer, single image-label writer 2026-08-13 12:03:29 +02:00
pause.go refactor(compose): extract forEachContainerConcurrent to deduplicate pause/kill logic 2026-05-12 11:31:40 +02:00
plan.go feat(reconcile): best-effort old-network removal on rename 2026-07-27 14:56:25 +02:00
plan_test.go tests: cover depends_on chaining and OpRunProvider stringer 2026-06-08 20:14:38 +02:00
plugins.go lint: replace gocyclo with gocognit 2026-08-18 10:42:37 +02:00
plugins_test.go fix: stop-only metadata no longer drops options for up/down 2026-05-18 11:11:38 +02:00
plugins_windows.go
port.go fix(compose/port): show private port in portNotFoundError message 2026-06-29 18:51:14 +02:00
pre_start.go pre_start: support pre_start lifecycle hooks 2026-06-30 10:49:04 +02:00
pre_start_test.go pre_start: support pre_start lifecycle hooks 2026-06-30 10:49:04 +02:00
printer.go next release will be major version v5.x 2025-11-13 09:32:43 +01:00
progress.go fix: restore stoppingEvent/stoppedEvent helpers for plugin stop hook 2026-05-18 15:12:39 +02:00
ps.go refactor: flatten Ps, restart and Logs orchestration 2026-08-18 13:37:48 +02:00
ps_test.go refactor: fix lint issues from cleanup changes 2026-05-12 11:31:40 +02:00
publish.go refactor: split publish push path and sensitive-data scanning 2026-08-18 13:37:48 +02:00
publish_test.go fix(config): pin type:image volume sources and pre_start hook images 2026-07-24 15:33:21 +02:00
pull.go refactor: materialize compose pull scheduling as an imagePuller 2026-08-18 13:37:48 +02:00
pull_test.go docs+test: disambiguate content digests from distribution digests 2026-08-13 12:03:29 +02:00
push.go modernize some code 2026-02-12 15:31:35 +01:00
reconcile.go fix(build): resolve image volumes to a mountable name, not a manifest digest 2026-08-13 12:03:29 +02:00
reconcile_test.go refactor(reconcile): aggregate observed resources, resolve conflicts in reconcile 2026-07-27 14:56:25 +02:00
remove.go lint: replace gocyclo with gocognit 2026-08-18 10:42:37 +02:00
restart.go refactor: flatten Ps, restart and Logs orchestration 2026-08-18 13:37:48 +02:00
run.go chore: fix some comments to improve readability 2026-06-09 11:45:13 +02:00
scale.go golangci-lint: use gci formatter instead of goimports 2025-12-01 12:21:50 +01:00
secrets.go chore: inline needless single-use helpers 2026-08-14 22:49:53 +02:00
shellout.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
start.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
stop.go perf: avoid duplicate provider metadata fetch on stop 2026-05-18 11:11:38 +02:00
stop_test.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
suffix_unix.go
top.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
up.go refactor: materialize interactive up as an upSession 2026-08-18 13:37:48 +02:00
up_test.go Fix up attach filtering 2026-03-25 10:07:02 +01:00
viz.go golangci-lint: use gci formatter instead of goimports 2025-12-01 12:21:50 +01:00
viz_test.go refactor: last gocognit candidates — bridge resources and TestViz 2026-08-18 13:37:48 +02:00
volumes.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
volumes_test.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
wait.go go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
watch.go refactor: flatten watch trigger preparation and initial sync walk 2026-08-18 13:37:48 +02:00
watch_test.go fix(watch): stop pruning every dangling image of the project 2026-08-11 08:05:14 +02:00