mirror of https://github.com/docker/compose.git
run ContainerWait in background so we catch container exit
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
83475569e6
commit
9af5ea4b6a
|
@ -83,7 +83,7 @@ func (s *composeService) attach(ctx context.Context, project *types.Project, lis
|
|||
s.attachContainer(ctx, container, listener, project) // nolint: errcheck
|
||||
delete(crashed, event.Container)
|
||||
|
||||
s.waitContainer(ctx, container, listener)
|
||||
s.waitContainer(container, listener)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
|
|
|
@ -51,14 +51,14 @@ func (s *composeService) Start(ctx context.Context, project *types.Project, opti
|
|||
for _, c := range containers {
|
||||
c := c
|
||||
go func() {
|
||||
s.waitContainer(ctx, c, options.Attach)
|
||||
s.waitContainer(c, options.Attach)
|
||||
}()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *composeService) waitContainer(ctx context.Context, c moby.Container, listener compose.ContainerEventListener) {
|
||||
statusC, errC := s.apiClient.ContainerWait(ctx, c.ID, container.WaitConditionNotRunning)
|
||||
func (s *composeService) waitContainer(c moby.Container, listener compose.ContainerEventListener) {
|
||||
statusC, errC := s.apiClient.ContainerWait(context.Background(), c.ID, container.WaitConditionNotRunning)
|
||||
name := getContainerNameWithoutProject(c)
|
||||
select {
|
||||
case status := <-statusC:
|
||||
|
|
Loading…
Reference in New Issue