mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Copy default configs from default Bridge to new bridge if not user configured
Also fixed a minor bug in client to choose bridge as the default driver. Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
parent
cad0f33910
commit
e67f9f4f79
2 changed files with 9 additions and 5 deletions
|
@ -45,7 +45,7 @@ func (cli *NetworkCli) CmdNetwork(chain string, args ...string) error {
|
||||||
// CmdNetworkCreate handles Network Create UI
|
// CmdNetworkCreate handles Network Create UI
|
||||||
func (cli *NetworkCli) CmdNetworkCreate(chain string, args ...string) error {
|
func (cli *NetworkCli) CmdNetworkCreate(chain string, args ...string) error {
|
||||||
cmd := cli.Subcmd(chain, "create", "NETWORK-NAME", "Creates a new network with a name specified by the user", false)
|
cmd := cli.Subcmd(chain, "create", "NETWORK-NAME", "Creates a new network with a name specified by the user", false)
|
||||||
flDriver := cmd.String([]string{"d", "-driver"}, "null", "Driver to manage the Network")
|
flDriver := cmd.String([]string{"d", "-driver"}, "bridge", "Driver to manage the Network")
|
||||||
cmd.Require(flag.Min, 1)
|
cmd.Require(flag.Min, 1)
|
||||||
err := cmd.ParseFlags(args, true)
|
err := cmd.ParseFlags(args, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -175,8 +175,8 @@ func (c *networkConfiguration) Conflict(o *networkConfiguration) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// FromMap retrieve the configuration data from the map form.
|
// fromMap retrieve the configuration data from the map form.
|
||||||
func (c *networkConfiguration) FromMap(data map[string]interface{}) error {
|
func (c *networkConfiguration) fromMap(data map[string]interface{}) error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if i, ok := data["BridgeName"]; ok && i != nil {
|
if i, ok := data["BridgeName"]; ok && i != nil {
|
||||||
|
@ -393,8 +393,12 @@ func parseNetworkGenericOptions(data interface{}) (*networkConfiguration, error)
|
||||||
case *networkConfiguration:
|
case *networkConfiguration:
|
||||||
config = opt
|
config = opt
|
||||||
case map[string]interface{}:
|
case map[string]interface{}:
|
||||||
config = &networkConfiguration{}
|
config = &networkConfiguration{
|
||||||
err = config.FromMap(opt)
|
EnableICC: true,
|
||||||
|
EnableIPTables: true,
|
||||||
|
EnableIPMasquerade: true,
|
||||||
|
}
|
||||||
|
err = config.fromMap(opt)
|
||||||
case options.Generic:
|
case options.Generic:
|
||||||
var opaqueConfig interface{}
|
var opaqueConfig interface{}
|
||||||
if opaqueConfig, err = options.GenerateFromModel(opt, config); err == nil {
|
if opaqueConfig, err = options.GenerateFromModel(opt, config); err == nil {
|
||||||
|
|
Loading…
Reference in a new issue