1
0
mirror of https://github.com/docker/cli.git synced 2026-01-13 18:22:35 +03:00

Let the api to choose the default network driver.

That way swarm can understand the user's intention.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 34668ad68bb42d7488649e41b32818f3f1a7cff2
Component: engine
This commit is contained in:
David Calavera
2015-10-29 16:48:25 -04:00
parent f8757c11b0
commit 961ca9c736

View File

@@ -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
@@ -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,