-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Add wait-timeout option to docker-compose up #12702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Dustin4444
wants to merge
1
commit into
docker:main
Choose a base branch
from
Dustin4444:add-wait-timeout
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains 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
Fixes docker#10269 Add `--wait-timeout` option to `docker-compose up` command to prevent waiting indefinitely for a service to become healthy. * **Documentation** - Add documentation for `--wait-timeout` option in `docs/reference/compose_up.md` - Explain the purpose of `--wait-timeout` option - Provide an example usage of `--wait-timeout` option * **Command Implementation** - Add `waitTimeout` field to `upOptions` struct in `cmd/compose/up.go` - Add `--wait-timeout` flag to `upCommand` function - Validate `--wait-timeout` flag in `validateFlags` function - Pass `waitTimeout` to `runUp` function - Update `runUp` function to handle `waitTimeout` * **Command Logic** - Add `waitTimeout` parameter to `UpOptions` struct in `pkg/compose/up.go` - Update `Up` function to handle `waitTimeout` - Implement timeout logic in `Up` function - Ensure `waitTimeout` is respected during `Up` execution * **Wait Command** - Add `waitTimeout` parameter to `waitOptions` struct in `cmd/compose/wait.go` - Add `--wait-timeout` flag to `waitCommand` function - Pass `waitTimeout` to `runWait` function - Update `runWait` function to handle `waitTimeout` * **Wait Logic** - Add `waitTimeout` parameter to `WaitOptions` struct in `pkg/compose/wait.go` - Update `Wait` function to handle `waitTimeout` - Implement timeout logic in `Wait` function - Ensure `waitTimeout` is respected during `Wait` execution --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/docker/compose/issues/10269?shareId=XXXX-XXXX-XXXX-XXXX).
Hey @Dustin4444 Can you explain the purpose of this PR? I mean you tried to fix an issue that was already address with a flag already present in the $ docker compose up --help 07:58:19
Usage: docker compose up [OPTIONS] [SERVICE...]
Create and start containers
Options:
--abort-on-container-exit Stops all containers if any container was stopped. Incompatible with -d
--abort-on-container-failure Stops all containers if any container exited with failure. Incompatible with -d
--always-recreate-deps Recreate dependent containers. Incompatible with --no-recreate.
--attach stringArray Restrict attaching to the specified services. Incompatible with --attach-dependencies.
--attach-dependencies Automatically attach to log output of dependent services
--build Build images before starting containers
-d, --detach Detached mode: Run containers in the background
--dry-run Execute command in dry run mode
--exit-code-from string Return the exit code of the selected service container. Implies --abort-on-container-exit
--force-recreate Recreate containers even if their configuration and image haven't changed
--menu Enable interactive shortcuts when running attached. Incompatible with --detach. Can also be enable/disable by setting COMPOSE_MENU environment var.
--no-attach stringArray Do not attach (stream logs) to the specified services
--no-build Don't build an image, even if it's policy
--no-color Produce monochrome output
--no-deps Don't start linked services
--no-log-prefix Don't print prefix in logs
--no-recreate If containers already exist, don't recreate them. Incompatible with --force-recreate.
--no-start Don't start the services after creating them
--pull string Pull image before running ("always"|"missing"|"never") (default "policy")
--quiet-pull Pull without printing progress information
--remove-orphans Remove containers for services not defined in the Compose file
-V, --renew-anon-volumes Recreate anonymous volumes instead of retrieving data from the previous containers
--scale scale Scale SERVICE to NUM instances. Overrides the scale setting in the Compose file if present.
-t, --timeout int Use this timeout in seconds for container shutdown when attached or when containers are already running
--timestamps Show timestamps
--wait Wait for services to be running|healthy. Implies detached mode.
--wait-timeout int Maximum duration in seconds to wait for the project to be running|healthy
-w, --watch Watch source code and rebuild/refresh containers when files are updated.
-y, --yes Assume "yes" as answer to all prompts and run non-interactively |
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.
Fixes #10269
Add
--wait-timeout
option todocker-compose up
command to prevent waiting indefinitely for a service to become healthy.Documentation
--wait-timeout
option indocs/reference/compose_up.md
--wait-timeout
option--wait-timeout
optionCommand Implementation
waitTimeout
field toupOptions
struct incmd/compose/up.go
--wait-timeout
flag toupCommand
function--wait-timeout
flag invalidateFlags
functionwaitTimeout
torunUp
functionrunUp
function to handlewaitTimeout
Command Logic
waitTimeout
parameter toUpOptions
struct inpkg/compose/up.go
Up
function to handlewaitTimeout
Up
functionwaitTimeout
is respected duringUp
executionWait Command
waitTimeout
parameter towaitOptions
struct incmd/compose/wait.go
--wait-timeout
flag towaitCommand
functionwaitTimeout
torunWait
functionrunWait
function to handlewaitTimeout
Wait Logic
waitTimeout
parameter toWaitOptions
struct inpkg/compose/wait.go
Wait
function to handlewaitTimeout
Wait
functionwaitTimeout
is respected duringWait
executionFor more details, open the Copilot Workspace session.