Skip to content

Commit

Permalink
Merge pull request #17504 from calavera/default_network_driver
Browse files Browse the repository at this point in the history
Let the api to choose the default network driver.
  • Loading branch information
tiborvass committed Oct 30, 2015
2 parents 82203d0 + 34668ad commit d7bdbdf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api/client/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ func (cli *DockerCli) CmdNetworkCreate(args ...string) error {
return err
}

// Set the default driver to "" if the user didn't set the value.
// That way we can know whether it was user input or not.
driver := *flDriver
if !cmd.IsSet("-driver") && !cmd.IsSet("d") {
driver = ""
}

ipamCfg, err := consolidateIpam(flIpamSubnet.GetAll(), flIpamIPRange.GetAll(), flIpamGateway.GetAll(), flIpamAux.GetAll())
if err != nil {
return err
Expand All @@ -62,7 +69,7 @@ func (cli *DockerCli) CmdNetworkCreate(args ...string) error {
// Construct network create request body
nc := types.NetworkCreate{
Name: cmd.Arg(0),
Driver: *flDriver,
Driver: driver,
IPAM: network.IPAM{Driver: *flIpamDriver, Config: ipamCfg},
Options: flOpts.GetAll(),
CheckDuplicate: true,
Expand Down

0 comments on commit d7bdbdf

Please sign in to comment.