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:
Mrunal Patel 2016-08-31 16:38:14 -07:00
parent 32a9f23dd2
commit c53b8c8afe

View file

@ -157,3 +157,11 @@ func (c *Container) Labels() map[string]string {
func (c *Container) Sandbox() string {
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
}