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

fix: Update down command to validate service names #12199

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cmd/compose/down.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ func runDown(ctx context.Context, dockerCli command.Cli, backend api.Service, op
return err
}

// Validate service names
if project != nil {
for _, service := range services {
if _, exists := project.Services[service]; !exists {
return fmt.Errorf("no such service: %s", service)
}
}
}

var timeout *time.Duration
if opts.timeChanged {
timeoutValue := time.Duration(opts.timeout) * time.Second
Expand Down