diff options
Diffstat (limited to 'pkg/spec/createconfig.go')
-rw-r--r-- | pkg/spec/createconfig.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go index 0bd6c6d1c..fb45f042b 100644 --- a/pkg/spec/createconfig.go +++ b/pkg/spec/createconfig.go @@ -381,8 +381,12 @@ func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime) ([]lib return nil, errors.Wrapf(err, "container %q not found", c.NetMode.ConnectedContainer()) } options = append(options, libpod.WithNetNSFrom(connectedCtr)) - } else if !rootless.IsRootless() && !c.NetMode.IsHost() && !c.NetMode.IsNone() { - postConfigureNetNS := (len(c.IDMappings.UIDMap) > 0 || len(c.IDMappings.GIDMap) > 0) && !c.UsernsMode.IsHost() + } else if !c.NetMode.IsHost() && !c.NetMode.IsNone() { + isRootless := rootless.IsRootless() + postConfigureNetNS := isRootless || (len(c.IDMappings.UIDMap) > 0 || len(c.IDMappings.GIDMap) > 0) && !c.UsernsMode.IsHost() + if isRootless && len(portBindings) > 0 { + return nil, errors.New("port bindings are not yet supported by rootless containers") + } options = append(options, libpod.WithNetNS(portBindings, postConfigureNetNS, networks)) } |