diff options
Diffstat (limited to 'pkg')
-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()) |