summaryrefslogtreecommitdiff
path: root/pkg/spec/createconfig.go
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2018-07-23 12:37:29 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-24 21:50:49 +0000
commit41c7e43b4dbba117d41d82cd8d5c0f004daba21e (patch)
tree15fee619996c847b99e19321485e49308aeec7f6 /pkg/spec/createconfig.go
parent6f65490e274e5cde5f5cb616719ea27932a764ee (diff)
downloadpodman-41c7e43b4dbba117d41d82cd8d5c0f004daba21e.tar.gz
podman-41c7e43b4dbba117d41d82cd8d5c0f004daba21e.tar.bz2
podman-41c7e43b4dbba117d41d82cd8d5c0f004daba21e.zip
network: support ns: prefix to join existing namespace
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #1145 Approved by: rhatdan
Diffstat (limited to 'pkg/spec/createconfig.go')
-rw-r--r--pkg/spec/createconfig.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go
index 57416732d..1dba8cdb4 100644
--- a/pkg/spec/createconfig.go
+++ b/pkg/spec/createconfig.go
@@ -370,17 +370,15 @@ func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime) ([]lib
}
}
- if rootless.IsRootless() {
- if !c.NetMode.IsHost() && !c.NetMode.IsNone() {
- options = append(options, libpod.WithNetNS(portBindings, true, networks))
- }
+ if IsNS(string(c.NetMode)) {
+ // pass
} else if c.NetMode.IsContainer() {
connectedCtr, err := c.Runtime.LookupContainer(c.NetMode.ConnectedContainer())
if err != nil {
return nil, errors.Wrapf(err, "container %q not found", c.NetMode.ConnectedContainer())
}
options = append(options, libpod.WithNetNSFrom(connectedCtr))
- } else if !c.NetMode.IsHost() && !c.NetMode.IsNone() {
+ } else if !rootless.IsRootless() && !c.NetMode.IsHost() && !c.NetMode.IsNone() {
postConfigureNetNS := (len(c.IDMappings.UIDMap) > 0 || len(c.IDMappings.GIDMap) > 0) && !c.UsernsMode.IsHost()
options = append(options, libpod.WithNetNS(portBindings, postConfigureNetNS, networks))
}