diff options
author | Matthew Heon <matthew.heon@pm.me> | 2020-02-02 12:51:03 -0500 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2020-02-02 12:51:03 -0500 |
commit | 6d487c781a7a046a72b3139319476948f855748e (patch) | |
tree | d5cbb2202794dba00a8bef08608ae8ae1c9fdc60 | |
parent | 4699d5e02d3270b5cc89f7528b53b823fbf88796 (diff) | |
download | podman-6d487c781a7a046a72b3139319476948f855748e.tar.gz podman-6d487c781a7a046a72b3139319476948f855748e.tar.bz2 podman-6d487c781a7a046a72b3139319476948f855748e.zip |
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 <matthew.heon@pm.me>
-rw-r--r-- | libpod/container_internal.go | 6 |
1 files changed, 6 insertions, 0 deletions
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 { |