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

Function runConnect

cli/command/network/connect.go:66–86  ·  view source on GitHub ↗
(ctx context.Context, apiClient client.NetworkAPIClient, options connectOptions)

Source from the content-addressed store, hash-verified

64}
65
66func runConnect(ctx context.Context, apiClient client.NetworkAPIClient, options connectOptions) error {
67 driverOpts, err := convertDriverOpt(options.driverOpts)
68 if err != nil {
69 return err
70 }
71 _, err = apiClient.NetworkConnect(ctx, options.network, client.NetworkConnectOptions{
72 Container: options.container,
73 EndpointConfig: &network.EndpointSettings{
74 IPAMConfig: &network.EndpointIPAMConfig{
75 IPv4Address: toNetipAddr(options.ipaddress),
76 IPv6Address: toNetipAddr(options.ipv6address),
77 LinkLocalIPs: toNetipAddrSlice(options.linklocalips),
78 },
79 Links: options.links.GetSlice(),
80 Aliases: options.aliases,
81 DriverOpts: driverOpts,
82 GwPriority: options.gwPriority,
83 },
84 })
85 return err
86}
87
88func convertDriverOpt(options []string) (map[string]string, error) {
89 driverOpt := make(map[string]string)

Callers 1

newConnectCommandFunction · 0.85

Calls 5

convertDriverOptFunction · 0.85
toNetipAddrFunction · 0.85
NetworkConnectMethod · 0.80
GetSliceMethod · 0.80
toNetipAddrSliceFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…