Skip to content

Commit

Permalink
podman stop: do not cleanup for auto-removal
Browse files Browse the repository at this point in the history
Do not perform a container clean up for containers configured for
auto-removal (e.g., via `podman run --rm`).  There is a small race
window with the other process performing the removal where a clean up
during podman-stop may fail since the container has already been removed
and cleaned up.  As the removing process will clean up the container,
we don't have to do it during podman-stop.

Fixes: containers#7384
Signed-off-by: Valentin Rothberg <[email protected]>
  • Loading branch information
vrothberg committed Sep 8, 2020
1 parent be7778d commit d3e05de
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/domain/infra/abi/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin
return err
}
}
if c.AutoRemove() {
// Issue #7384: if the container is configured for
// auto-removal, it might already have been removed at
// this point.
return nil
}
return c.Cleanup(ctx)
})
if err != nil {
Expand Down

0 comments on commit d3e05de

Please sign in to comment.