summaryrefslogtreecommitdiff
path: root/cmd/podman/networks/create.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/networks/create.go')
-rw-r--r--cmd/podman/networks/create.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmd/podman/networks/create.go b/cmd/podman/networks/create.go
index 938b8da77..8db4bb89a 100644
--- a/cmd/podman/networks/create.go
+++ b/cmd/podman/networks/create.go
@@ -30,6 +30,7 @@ var (
var (
networkCreateOptions entities.NetworkCreateOptions
labels []string
+ opts []string
)
func networkCreateFlags(cmd *cobra.Command) {
@@ -39,6 +40,10 @@ func networkCreateFlags(cmd *cobra.Command) {
flags.StringVarP(&networkCreateOptions.Driver, driverFlagName, "d", "bridge", "driver to manage the network")
_ = cmd.RegisterFlagCompletionFunc(driverFlagName, common.AutocompleteNetworkDriver)
+ optFlagName := "opt"
+ flags.StringArrayVarP(&opts, optFlagName, "o", []string{}, "Set driver specific options (default [])")
+ _ = cmd.RegisterFlagCompletionFunc(optFlagName, completion.AutocompleteNone)
+
gatewayFlagName := "gateway"
flags.IPVar(&networkCreateOptions.Gateway, gatewayFlagName, nil, "IPv4 or IPv6 gateway for the subnet")
_ = cmd.RegisterFlagCompletionFunc(gatewayFlagName, completion.AutocompleteNone)
@@ -93,6 +98,10 @@ func networkCreate(cmd *cobra.Command, args []string) error {
if err != nil {
return errors.Wrap(err, "failed to parse labels")
}
+ networkCreateOptions.Options, err = parse.GetAllLabels([]string{}, opts)
+ if err != nil {
+ return errors.Wrapf(err, "unable to process options")
+ }
response, err := registry.ContainerEngine().NetworkCreate(registry.Context(), name, networkCreateOptions)
if err != nil {
return err