summaryrefslogtreecommitdiff
path: root/cmd/podman/create.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-01-15 14:17:31 -0600
committerAtomic Bot <atomic-devel@projectatomic.io>2018-01-15 21:17:59 +0000
commita7ad6e75ab967a51ee8dcd9c8dbc81c949e21d21 (patch)
treea4add509476edb2b71d9ec683d259207917add0a /cmd/podman/create.go
parent2e48c60bc5f7eb6b301c696f9e4c1cabaf1ec4aa (diff)
downloadpodman-a7ad6e75ab967a51ee8dcd9c8dbc81c949e21d21.tar.gz
podman-a7ad6e75ab967a51ee8dcd9c8dbc81c949e21d21.tar.bz2
podman-a7ad6e75ab967a51ee8dcd9c8dbc81c949e21d21.zip
Make --net alias to --network
A compatibility option of --net should alias the --network option. The --net option will only override --network if --network is not explicitly set and --net is. Both default to 'bridge'. Signed-off-by: baude <bbaude@redhat.com> Closes: #228 Approved by: mheon
Diffstat (limited to 'cmd/podman/create.go')
-rw-r--r--cmd/podman/create.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/cmd/podman/create.go b/cmd/podman/create.go
index 14c520174..83115c527 100644
--- a/cmd/podman/create.go
+++ b/cmd/podman/create.go
@@ -542,6 +542,17 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime, imageName string,
if err != nil {
return nil, errors.Wrapf(err, "unable to translate --shm-size")
}
+ // Network
+ // Both --network and --net have default values of 'bridge'
+ // --net only overrides --network when --network is not explicitly
+ // set and --net is.
+ if c.IsSet("network") && c.IsSet("net") {
+ return nil, errors.Errorf("cannot use --network and --net together. use only --network instead")
+ }
+ networkMode := c.String("network")
+ if !c.IsSet("network") && c.IsSet("net") {
+ networkMode = c.String("net")
+ }
config := &createConfig{
Runtime: runtime,
@@ -570,10 +581,10 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime, imageName string,
LogDriverOpt: c.StringSlice("log-opt"),
MacAddress: c.String("mac-address"),
Name: c.String("name"),
- Network: c.String("network"),
+ Network: networkMode,
NetworkAlias: c.StringSlice("network-alias"),
IpcMode: ipcMode,
- NetMode: container.NetworkMode(c.String("network")),
+ NetMode: container.NetworkMode(networkMode),
UtsMode: utsMode,
PidMode: pidMode,
Pod: c.String("pod"),