Merge pull request #11535 from ndeloof/simpler

make code simpler
This commit is contained in:
Guillaume Lours 2024-03-01 10:02:12 +01:00 committed by GitHub
commit a7acf5fa67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 7 deletions

View File

@ -127,13 +127,7 @@ func isNotService(services ...string) containerPredicate {
// isOrphaned is a predicate to select containers without a matching service definition in compose project
func isOrphaned(project *types.Project) containerPredicate {
var services []string
for _, s := range project.Services {
services = append(services, s.Name)
}
for _, s := range project.DisabledServices {
services = append(services, s.Name)
}
services := append(project.ServiceNames(), project.DisabledServiceNames()...)
return func(c moby.Container) bool {
service := c.Labels[api.ServiceLabel]
return !utils.StringContains(services, service)