mirror of
https://github.com/moby/moby.git
synced 2026-08-10 17:15:06 +00:00
Merge pull request #50136 from mabrarov/50133-container_stop_state_sync
fix: daemon: state of stopped container visible to other queries when container is stopped
This commit is contained in:
@@ -93,6 +93,9 @@ func (daemon *Daemon) containerStop(ctx context.Context, ctr *container.Containe
|
||||
defer cancel()
|
||||
|
||||
if status := <-ctr.Wait(subCtx, containertypes.WaitConditionNotRunning); status.Err() == nil {
|
||||
// Ensure container status changes are committed by handler of container exit before returning control to the caller
|
||||
ctr.Lock()
|
||||
defer ctr.Unlock()
|
||||
// container did exit, so ignore any previous errors and return
|
||||
return nil
|
||||
}
|
||||
@@ -122,5 +125,9 @@ func (daemon *Daemon) containerStop(ctx context.Context, ctr *container.Containe
|
||||
// container did exit, so ignore previous errors and continue
|
||||
}
|
||||
|
||||
// Ensure container status changes are committed by handler of container exit before returning control to the caller
|
||||
ctr.Lock()
|
||||
defer ctr.Unlock()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user