diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2018-06-01 13:16:25 +0200 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-06-15 14:53:18 +0000 |
commit | c976d49805aa909ca3ec2de318852b5c5d378656 (patch) | |
tree | 7dcbc4cd7b1003bcdf430534cf7361097a361a9b /pkg/spec | |
parent | 3861098fb39b8f83490d6d4ab600364b92a4fb59 (diff) | |
download | podman-c976d49805aa909ca3ec2de318852b5c5d378656.tar.gz podman-c976d49805aa909ca3ec2de318852b5c5d378656.tar.bz2 podman-c976d49805aa909ca3ec2de318852b5c5d378656.zip |
network: do not attempt to create a network in rootless mode
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #871
Approved by: mheon
Diffstat (limited to 'pkg/spec')
-rw-r--r-- | pkg/spec/createconfig.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go index 4d29fb3bd..36a6e83f2 100644 --- a/pkg/spec/createconfig.go +++ b/pkg/spec/createconfig.go @@ -360,7 +360,11 @@ func (c *CreateConfig) GetContainerCreateOptions() ([]libpod.CtrCreateOption, er // does not have one options = append(options, libpod.WithEntrypoint(c.Entrypoint)) - if c.NetMode.IsContainer() { + if os.Getuid() != 0 { + if !c.NetMode.IsHost() && !c.NetMode.IsNone() { + options = append(options, libpod.WithNetNS(portBindings, true)) + } + } 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()) |