summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/spec.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd/podman/spec.go b/cmd/podman/spec.go
index 35c6ef130..df1c54d50 100644
--- a/cmd/podman/spec.go
+++ b/cmd/podman/spec.go
@@ -545,15 +545,15 @@ func (c *createConfig) GetContainerCreateOptions() ([]libpod.CtrCreateOption, er
options = append(options, libpod.WithName(c.Name))
}
// TODO parse ports into libpod format and include
- if !c.NetMode.IsHost() && !c.NetMode.IsContainer() {
- options = append(options, libpod.WithNetNS([]ocicni.PortMapping{}))
- } else if c.NetMode.IsContainer() {
+ 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() {
+ options = append(options, libpod.WithNetNS([]ocicni.PortMapping{}))
}
if c.PidMode.IsContainer() {
connectedCtr, err := c.Runtime.LookupContainer(c.PidMode.Container())