From 30544f225e73a4180f4afb0d062006c9fa61a309 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Tue, 11 May 2021 18:41:36 +0200 Subject: fix restart always with slirp4netns When a container is automatically restarted due its restart policy and the container used the slirp4netns netmode, the slirp4netns process died. This caused the container to lose network connectivity. To fix this we have to start a new slirp4netns process. Fixes #8047 Signed-off-by: Paul Holzinger --- libpod/container_internal.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libpod/container_internal.go') diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 051fe4b9e..53b85a466 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -283,6 +283,14 @@ func (c *Container) handleRestartPolicy(ctx context.Context) (_ bool, retErr err return false, err } + // setup slirp4netns again because slirp4netns will die when conmon exits + if c.config.NetMode.IsSlirp4netns() { + err := c.runtime.setupSlirp4netns(c) + if err != nil { + return false, err + } + } + if c.state.State == define.ContainerStateStopped { // Reinitialize the container if we need to if err := c.reinit(ctx, true); err != nil { -- cgit v1.2.3-54-g00ecf