Skip to content
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

Ignore missing containers when compose down/stop -p #11692

Merged
merged 3 commits into from
Apr 11, 2024

Conversation

koooge
Copy link
Contributor

@koooge koooge commented Apr 6, 2024

What I did
Fix the error of docker compose down/stop with -p could not find <container>: not found when there are services depend_on missing containers. The scenario is particularly likely to happen when using initial containers. docker system prune is one reason to remove init containers, for example.

Related issue

fixes #11686

(not mandatory) A picture of a cute animal, if possible in relation to what you did

@koooge koooge changed the title Ignore missing containers when compose down --remove-orphans Ignore missing containers when compose down/stop -p Apr 7, 2024
@@ -77,7 +77,7 @@ func downDirectionTraversal(visitorFn func(context.Context, string) error) *grap

// InDependencyOrder applies the function to the services of the project taking in account the dependency order
func InDependencyOrder(ctx context.Context, project *types.Project, fn func(context.Context, string) error, options ...func(*graphTraversal)) error {
graph, err := NewGraph(project, ServiceStopped)
graph, err := NewGraph(project, ServiceStopped, false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an alternative approach is to use project.WithServicesTransform to set DependsOn.Required = false on all services, s you don't need API change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 0e58676

@ndeloof ndeloof merged commit 5059a1d into docker:main Apr 11, 2024
28 checks passed
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.

[BUG] compose down fails when it depends_on missing init containers
2 participants