File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -92,8 +92,13 @@ func runCreate(dockerCli command.Cli, options createOptions) error {
9292 return err
9393 }
9494
95- // Construct network create request body
96- nc := types.NetworkCreate {
95+ var configFrom * network.ConfigReference
96+ if options .configFrom != "" {
97+ configFrom = & network.ConfigReference {
98+ Network : options .configFrom ,
99+ }
100+ }
101+ resp , err := client .NetworkCreate (context .Background (), options .name , types.NetworkCreate {
97102 Driver : options .driver ,
98103 Options : options .driverOpts .GetAll (),
99104 IPAM : & network.IPAM {
@@ -107,16 +112,9 @@ func runCreate(dockerCli command.Cli, options createOptions) error {
107112 Ingress : options .ingress ,
108113 Scope : options .scope ,
109114 ConfigOnly : options .configOnly ,
115+ ConfigFrom : configFrom ,
110116 Labels : opts .ConvertKVStringsToMap (options .labels .GetAll ()),
111- }
112-
113- if from := options .configFrom ; from != "" {
114- nc .ConfigFrom = & network.ConfigReference {
115- Network : from ,
116- }
117- }
118-
119- resp , err := client .NetworkCreate (context .Background (), options .name , nc )
117+ })
120118 if err != nil {
121119 return err
122120 }
You can’t perform that action at this time.
0 commit comments