Add API to get container network namespace path
We need this for networking integration. Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
parent
32a9f23dd2
commit
c53b8c8afe
1 changed files with 8 additions and 0 deletions
|
@ -157,3 +157,11 @@ func (c *Container) Labels() map[string]string {
|
||||||
func (c *Container) Sandbox() string {
|
func (c *Container) Sandbox() string {
|
||||||
return c.sandbox
|
return c.sandbox
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NetNsPath returns the path to the network namespace of the container.
|
||||||
|
func (c *Container) NetNsPath() (string, error) {
|
||||||
|
if c.state == nil {
|
||||||
|
return "", fmt.Errorf("container state is not populated")
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("/proc/%d/ns/net", c.state.Pid), nil
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue