run ContainerStart sequentially
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
2352a4a016
commit
4f6cc2a330
@ -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
|
||||
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user