Merge pull request #1562 from docker/atoi

scale must ignore oneoff containers
This commit is contained in:
Nicolas De loof 2021-04-19 12:46:41 +02:00 committed by GitHub
commit 9f23d9e992
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -83,6 +83,11 @@ func isNotService(services ...string) containerPredicate {
}
}
func isNotOneOff(c moby.Container) bool {
v, ok := c.Labels[oneoffLabel]
return !ok || v == "False"
}
// filter return Containers with elements to match predicate
func (containers Containers) filter(predicate containerPredicate) Containers {
var filtered Containers

View File

@ -52,7 +52,7 @@ func (s *composeService) ensureScale(ctx context.Context, project *types.Project
return nil, nil, err
}
observedState := cState.GetContainers()
actual := observedState.filter(isService(service.Name))
actual := observedState.filter(isService(service.Name)).filter(isNotOneOff)
scale, err := getScale(service)
if err != nil {
return nil, nil, err