Skip to content

Commit

Permalink
Always save own namespace paths
Browse files Browse the repository at this point in the history
fix #1476

If containerA shares namespace, say ipc namespace, with containerB, then
its ipc namespace path would be the same as containerB and be stored in
`state.json`. Exec into containerA will just read the namespace paths
stored in this file and join these namespaces. So, if containerB has
already been stopped, `docker exec containerA` will fail.

To address this issue, we should always save own namespace paths no
matter if we share namespaces with other containers.

Signed-off-by: Yuanhong Peng <pengyuanhong@huawei.com>
  • Loading branch information
Yuanhong Peng committed Jun 6, 2017
1 parent 3723495 commit 56e00e7
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions libcontainer/configs/namespaces_linux.go
Original file line number Diff line number Diff line change
@@ -79,9 +79,6 @@ type Namespace struct {
}

func (n *Namespace) GetPath(pid int) string {
if n.Path != "" {
return n.Path
}
return fmt.Sprintf("/proc/%d/ns/%s", pid, NsName(n.Type))
}

0 comments on commit 56e00e7

Please sign in to comment.