MCPcopy Index your code
hub / github.com/docker/cli / runCreate

Function runCreate

cli/command/network/create.go:105–130  ·  view source on GitHub ↗
(ctx context.Context, apiClient client.NetworkAPIClient, output io.Writer, options createOptions)

Source from the content-addressed store, hash-verified

103}
104
105func runCreate(ctx context.Context, apiClient client.NetworkAPIClient, output io.Writer, options createOptions) error {
106 ipamCfg, err := createIPAMConfig(options.ipam)
107 if err != nil {
108 return err
109 }
110
111 resp, err := apiClient.NetworkCreate(ctx, options.name, client.NetworkCreateOptions{
112 Driver: options.driver,
113 Options: options.driverOpts.GetAll(),
114 IPAM: ipamCfg,
115 Internal: options.internal,
116 EnableIPv4: options.ipv4,
117 EnableIPv6: options.ipv6,
118 Attachable: options.attachable,
119 Ingress: options.ingress,
120 Scope: options.scope,
121 ConfigOnly: options.configOnly,
122 ConfigFrom: options.configFrom,
123 Labels: opts.ConvertKVStringsToMap(options.labels.GetSlice()),
124 })
125 if err != nil {
126 return err
127 }
128 _, _ = fmt.Fprintln(output, resp.ID)
129 return nil
130}
131
132// Consolidates the ipam configuration as a group from different related configurations
133// user can configure network with multiple non-overlapping subnets and hence it is

Callers 1

newCreateCommandFunction · 0.70

Calls 4

createIPAMConfigFunction · 0.85
NetworkCreateMethod · 0.80
GetSliceMethod · 0.80
GetAllMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…