Skip to content

Allow --wait to stream logs via --attach/--attach-dependencies - #14187

Open
NAVEENKUMARKR777 wants to merge 1 commit into
docker:mainfrom
NAVEENKUMARKR777:9122-stream-logs-during-wait
Open

Allow --wait to stream logs via --attach/--attach-dependencies#14187
NAVEENKUMARKR777 wants to merge 1 commit into
docker:mainfrom
NAVEENKUMARKR777:9122-stream-logs-during-wait

Conversation

@NAVEENKUMARKR777

Copy link
Copy Markdown

Summary

  • --wait has always implied detached mode, so there was no way to see a service's logs while waiting for it to become running|healthy short of running compose logs -f in parallel (open since 2022, requested repeatedly).
  • --wait can now be combined with --attach or --attach-dependencies: the attached services' logs stream normally while --wait polls for the condition, then the session detaches (leaving containers running) once the condition is met — exactly like the existing keyboard detach shortcut — instead of following logs forever like a plain foreground up.
  • Plain --wait (no --attach/--attach-dependencies) keeps its historical silent, detached behavior unchanged. --wait remains incompatible with --abort-on-container-exit, --abort-on-container-failure and --watch.
  • Updates the --wait flag help text and CLI reference docs accordingly.

Test plan

  • go test ./cmd/compose/... ./pkg/compose/... — new validateFlags unit tests covering the flag combinations
  • golangci-lint run --build-tags e2e ./... — 0 issues
  • New e2e scenarios (TestWaitStreamsLogsThenDetaches, TestWaitAloneStaysSilent) added but not run in this environment — no Docker daemon available. Please run go test -tags e2e ./pkg/e2e/ -run TestWait before merging.

Closes #9122

🤖 Generated with Claude Code

--wait has always implied detached mode, so there was no way to see a
service's logs while waiting for it to become running|healthy short of
running `compose logs -f` in parallel.

--wait can now be combined with --attach or --attach-dependencies: the
attached services' logs stream normally while --wait polls for the
condition, then the session detaches (leaving containers running) once the
condition is met, exactly like the existing keyboard detach shortcut,
instead of following logs forever like a plain foreground `up`.

Plain --wait (no --attach/--attach-dependencies) keeps its historical
silent, detached behavior unchanged. --wait remains incompatible with
--abort-on-container-exit, --abort-on-container-failure and --watch.

Closes docker#9122

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Naveenkumar <naveenkumarkr555@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stream logs during --wait

1 participant