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

Function ContainerNetNSPath

pkg/containerutil/containerutil.go:91–104  ·  view source on GitHub ↗

ContainerNetNSPath returns the netns path of a container.

(ctx context.Context, c containerd.Container)

Source from the content-addressed store, hash-verified

89
90// ContainerNetNSPath returns the netns path of a container.
91func ContainerNetNSPath(ctx context.Context, c containerd.Container) (string, error) {
92 task, err := c.Task(ctx, nil)
93 if err != nil {
94 return "", err
95 }
96 status, err := task.Status(ctx)
97 if err != nil {
98 return "", err
99 }
100 if status.Status != containerd.Running {
101 return "", fmt.Errorf("invalid target container: %s, should be running", c.ID())
102 }
103 return fmt.Sprintf("/proc/%d/ns/net", task.Pid()), nil
104}
105
106// UpdateStatusLabel updates the "containerd.io/restart.status"
107// label of the container according to the value of restart desired status.

Callers 2

ReconfigNetContainerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…