Allow --wait to stream logs via --attach/--attach-dependencies - #14187
Open
NAVEENKUMARKR777 wants to merge 1 commit into
Open
Allow --wait to stream logs via --attach/--attach-dependencies#14187NAVEENKUMARKR777 wants to merge 1 commit into
NAVEENKUMARKR777 wants to merge 1 commit into
Conversation
--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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--waithas always implied detached mode, so there was no way to see a service's logs while waiting for it to becomerunning|healthyshort of runningcompose logs -fin parallel (open since 2022, requested repeatedly).--waitcan now be combined with--attachor--attach-dependencies: the attached services' logs stream normally while--waitpolls 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 foregroundup.--wait(no--attach/--attach-dependencies) keeps its historical silent, detached behavior unchanged.--waitremains incompatible with--abort-on-container-exit,--abort-on-container-failureand--watch.--waitflag help text and CLI reference docs accordingly.Test plan
go test ./cmd/compose/... ./pkg/compose/...— newvalidateFlagsunit tests covering the flag combinationsgolangci-lint run --build-tags e2e ./...— 0 issuesTestWaitStreamsLogsThenDetaches,TestWaitAloneStaysSilent) added but not run in this environment — no Docker daemon available. Please rungo test -tags e2e ./pkg/e2e/ -run TestWaitbefore merging.Closes #9122
🤖 Generated with Claude Code