From 6d487c781a7a046a72b3139319476948f855748e Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Sun, 2 Feb 2020 12:51:03 -0500 Subject: Tear down network when restarting containers This makes restart a bit slower for root containers, but it does make it more consistent with `podman stop` and `podman start` on a container. Importantly, `podman restart` will now recreate firewall rules if they were somehow purged. Fixes #5051 Signed-off-by: Matthew Heon --- libpod/container_internal.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 0e883588c..78ec09f29 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -1254,6 +1254,12 @@ func (c *Container) restartWithTimeout(ctx context.Context, timeout uint) (err e } } } + // Ensure we tear down the container network so it will be + // recreated - otherwise, behavior of restart differs from stop + // and start + if err := c.cleanupNetwork(); err != nil { + return err + } } defer func() { if err != nil { -- cgit v1.2.3-54-g00ecf