diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2018-07-25 15:15:13 +0200 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-07-31 13:39:29 +0000 |
commit | cfcd92847684fc65949350b7cdc4769ad1099d46 (patch) | |
tree | afb9f946fb54fc990d83b9814b77e522b9bd4221 /pkg | |
parent | 5b9c60cc10f7dec6d0b030ad16646728f30a67e9 (diff) | |
download | podman-cfcd92847684fc65949350b7cdc4769ad1099d46.tar.gz podman-cfcd92847684fc65949350b7cdc4769ad1099d46.tar.bz2 podman-cfcd92847684fc65949350b7cdc4769ad1099d46.zip |
network: add support for rootless network with slirp4netns
slirp4netns is required to setup the network namespace:
https://github.com/rootless-containers/slirp4netns
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #1156
Approved by: rhatdan
Diffstat (limited to 'pkg')
-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)) } |