MCPcopy Create free account
hub / github.com/containerd/nerdctl / getExtraHosts

Function getExtraHosts

pkg/ocihook/ocihook.go:291–305  ·  view source on GitHub ↗
(state *specs.State)

Source from the content-addressed store, hash-verified

289}
290
291func getExtraHosts(state *specs.State) (map[string]string, error) {
292 extraHostsJSON := state.Annotations[labels.ExtraHosts]
293 var extraHosts []string
294 if err := json.Unmarshal([]byte(extraHostsJSON), &extraHosts); err != nil {
295 return nil, err
296 }
297
298 hosts := make(map[string]string)
299 for _, host := range extraHosts {
300 if v := strings.SplitN(host, ":", 2); len(v) == 2 {
301 hosts[v[0]] = v[1]
302 }
303 }
304 return hosts, nil
305}
306
307func getNetNSPath(state *specs.State) (string, error) {
308 // If we have a network-namespace annotation we use it over the passed Pid.

Callers 1

newHandlerOptsFunction · 0.85

Calls 1

UnmarshalMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…