Only use rootless RLK when the container has ports

Do not invoke the rootlesskit port forwarder when the container has no
ports.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
This commit is contained in:
Paul Holzinger 2021-02-23 15:16:15 +01:00
parent 8627de28bc
commit db19224b6d
1 changed files with 1 additions and 1 deletions

View File

@ -436,7 +436,7 @@ func (r *Runtime) setupRootlessNetNS(ctr *Container) error {
if err != nil {
return err
}
if len(networks) > 0 {
if len(networks) > 0 && len(ctr.config.PortMappings) > 0 {
// set up port forwarder for CNI-in-slirp4netns
netnsPath := ctr.state.NetNS.Path()
// TODO: support slirp4netns port forwarder as well