MCPcopy
hub / github.com/moby/moby / initializeNetworkingPaths

Method initializeNetworkingPaths

daemon/container_operations_windows.go:177–215  ·  view source on GitHub ↗
(ctr *container.Container, nc *container.Container)

Source from the content-addressed store, hash-verified

175}
176
177func (daemon *Daemon) initializeNetworkingPaths(ctr *container.Container, nc *container.Container) error {
178 if nc.HostConfig.Isolation.IsHyperV() {
179 return fmt.Errorf("sharing of hyperv containers network is not supported")
180 }
181
182 ctr.NetworkSharedContainerID = nc.ID
183
184 if nc.NetworkSettings != nil {
185 for n := range nc.NetworkSettings.Networks {
186 sn, err := daemon.FindNetwork(n)
187 if err != nil {
188 continue
189 }
190
191 ep, err := getEndpointInNetwork(nc.Name, sn)
192 if err != nil {
193 continue
194 }
195
196 data, err := ep.DriverInfo()
197 if err != nil {
198 continue
199 }
200
201 if data["GW_INFO"] != nil {
202 gwInfo := data["GW_INFO"].(map[string]any)
203 if gwInfo["hnsid"] != nil {
204 ctr.SharedEndpointList = append(ctr.SharedEndpointList, gwInfo["hnsid"].(string))
205 }
206 }
207
208 if data["hnsid"] != nil {
209 ctr.SharedEndpointList = append(ctr.SharedEndpointList, data["hnsid"].(string))
210 }
211 }
212 }
213
214 return nil
215}

Callers

nothing calls this directly

Calls 5

FindNetworkMethod · 0.95
getEndpointInNetworkFunction · 0.85
IsHyperVMethod · 0.80
ErrorfMethod · 0.80
DriverInfoMethod · 0.45

Tested by

no test coverage detected