Skip to content

Commit 6535976

Browse files
committed
Adding scope option
- To promote a network to swarm mode Signed-off-by: Alessandro Boch <[email protected]>
1 parent 088518b commit 6535976

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

cli/command/network/create.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818

1919
type createOptions struct {
2020
name string
21+
scope string
2122
driver string
2223
driverOpts opts.MapOpts
2324
labels opts.ListOpts
@@ -64,9 +65,11 @@ func newCreateCommand(dockerCli *command.DockerCli) *cobra.Command {
6465
flags.SetAnnotation("attachable", "version", []string{"1.25"})
6566
flags.BoolVar(&options.ingress, "ingress", false, "Create swarm routing-mesh network")
6667
flags.SetAnnotation("ingress", "version", []string{"1.29"})
67-
flags.BoolVar(&opts.configOnly, "config-only", false, "Create a configuration only network")
68+
flags.StringVar(&options.scope, "scope", "", "Control the network's scope")
69+
flags.SetAnnotation("scope", "version", []string{"1.30"})
70+
flags.BoolVar(&options.configOnly, "config-only", false, "Create a configuration only network")
6871
flags.SetAnnotation("config-only", "version", []string{"1.30"})
69-
flags.StringVar(&opts.configFrom, "config-from", "", "The network from which copying the configuration")
72+
flags.StringVar(&options.configFrom, "config-from", "", "The network from which copying the configuration")
7073
flags.SetAnnotation("config-from", "version", []string{"1.30"})
7174

7275
flags.StringVar(&options.ipamDriver, "ipam-driver", "default", "IP Address Management Driver")
@@ -102,6 +105,7 @@ func runCreate(dockerCli *command.DockerCli, options createOptions) error {
102105
EnableIPv6: options.ipv6,
103106
Attachable: options.attachable,
104107
Ingress: options.ingress,
108+
Scope: options.scope,
105109
ConfigOnly: options.configOnly,
106110
Labels: runconfigopts.ConvertKVStringsToMap(opts.labels.GetAll()),
107111
}
@@ -112,7 +116,7 @@ func runCreate(dockerCli *command.DockerCli, options createOptions) error {
112116
}
113117
}
114118

115-
resp, err := client.NetworkCreate(context.Background(), opts.name, nc)
119+
resp, err := client.NetworkCreate(context.Background(), options.name, nc)
116120
if err != nil {
117121
return err
118122
}

0 commit comments

Comments
 (0)