Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions pkg/compose/convergence.go
Original file line number Diff line number Diff line change
Expand Up @@ -650,9 +650,14 @@ func (s *composeService) recreateContainer(ctx context.Context, project *types.P
return created, err
}

// force sequential calls to ContainerStart to prevent race condition in engine assigning ports from ranges
var startMx sync.Mutex

func (s *composeService) startContainer(ctx context.Context, ctr containerType.Summary) error {
w := progress.ContextWriter(ctx)
w.Event(progress.NewEvent(getContainerProgressName(ctr), progress.Working, "Restart"))
startMx.Lock()
defer startMx.Unlock()
err := s.apiClient().ContainerStart(ctx, ctr.ID, containerType.StartOptions{})
if err != nil {
return err
Expand Down
12 changes: 11 additions & 1 deletion pkg/e2e/fixtures/port-range/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,14 @@ services:
image: nginx:alpine
scale: 5
ports:
- "6005-6015:80"
- "6005-6015:80"

b:
image: nginx:alpine
ports:
- 80

c:
image: nginx:alpine
ports:
- 80