diff options
author | Paul Holzinger <pholzing@redhat.com> | 2021-09-13 15:52:49 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2021-09-13 22:52:39 +0200 |
commit | 6221f269a8936876034a342010b89bc71f8bbe95 (patch) | |
tree | eef8d9717501dfb126a72baa19f893d8113b4aec /libpod | |
parent | 32424d9a9be09be3887fec903d960c87f5aedf28 (diff) | |
download | podman-6221f269a8936876034a342010b89bc71f8bbe95.tar.gz podman-6221f269a8936876034a342010b89bc71f8bbe95.tar.bz2 podman-6221f269a8936876034a342010b89bc71f8bbe95.zip |
fix restart always with rootlessport
When a container is automatically restarted due its restart policy and
the container uses rootless cni networking with ports forwarded we have
to start a new rootlessport process since it exits with conmon.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_internal.go | 9 | ||||
-rw-r--r-- | libpod/networking_linux.go | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 4d1a25541..18b80475b 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -293,6 +293,15 @@ func (c *Container) handleRestartPolicy(ctx context.Context) (_ bool, retErr err } } + // setup rootlesskit port forwarder again since it dies when conmon exits + // we use rootlesskit port forwarder only as rootless and when bridge network is used + if rootless.IsRootless() && c.config.NetMode.IsBridge() && len(c.config.PortMappings) > 0 { + err := c.runtime.setupRootlessPortMappingViaRLK(c, c.state.NetNS.Path()) + 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 { diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go index 9aa6cab15..b0d4e0b2d 100644 --- a/libpod/networking_linux.go +++ b/libpod/networking_linux.go @@ -718,6 +718,7 @@ func (r *Runtime) setupRootlessNetNS(ctr *Container) error { // set up port forwarder for CNI-in-slirp4netns netnsPath := ctr.state.NetNS.Path() // TODO: support slirp4netns port forwarder as well + // make sure to fix this container.handleRestartPolicy() as well return r.setupRootlessPortMappingViaRLK(ctr, netnsPath) } return nil |