Skip to content

Commit

Permalink
When stopping containers locally, ensure cleanup runs
Browse files Browse the repository at this point in the history
The cleanup process was already running and ensuring that mounts
and networking configuration was cleaned up on container stop,
but this was async from the actual `podman stop` command which
breaks some expectations - the container is still mounted at the
end of `podman stop` and will be cleaned up soon, but not
immediately. Fortunately, it's a trivial change to resolve this.

Fixes containers#5747

Signed-off-by: Matthew Heon <[email protected]>
  • Loading branch information
mheon committed Jun 3, 2020
1 parent bba0a8b commit 61ea85b
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 @@ -179,6 +179,12 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin
report.Err = err
reports = append(reports, &report)
continue
} else if err := con.Cleanup(ctx); err != nil {
// Only if no error, proceed to cleanup to ensure all
// mounts are removed before we exit.
report.Err = err
reports = append(reports, &report)
continue
}
reports = append(reports, &report)
}
Expand Down

0 comments on commit 61ea85b

Please sign in to comment.