Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 9f23d9e

Browse files
authored
Merge pull request #1562 from docker/atoi
scale must ignore oneoff containers
2 parents cd437d1 + a881976 commit 9f23d9e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

local/compose/containers.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ func isNotService(services ...string) containerPredicate {
8383
}
8484
}
8585

86+
func isNotOneOff(c moby.Container) bool {
87+
v, ok := c.Labels[oneoffLabel]
88+
return !ok || v == "False"
89+
}
90+
8691
// filter return Containers with elements to match predicate
8792
func (containers Containers) filter(predicate containerPredicate) Containers {
8893
var filtered Containers

local/compose/convergence.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (s *composeService) ensureScale(ctx context.Context, project *types.Project
5252
return nil, nil, err
5353
}
5454
observedState := cState.GetContainers()
55-
actual := observedState.filter(isService(service.Name))
55+
actual := observedState.filter(isService(service.Name)).filter(isNotOneOff)
5656
scale, err := getScale(service)
5757
if err != nil {
5858
return nil, nil, err

0 commit comments

Comments
 (0)