Skip to content

Commit

Permalink
Only unshare the mount namespace for execin
Browse files Browse the repository at this point in the history
Fixes moby#4728
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
  • Loading branch information
crosbymichael committed Mar 18, 2014
1 parent fb503da commit 4b1513f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/libcontainer/nsinit/execin.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ import (

// ExecIn uses an existing pid and joins the pid's namespaces with the new command.
func (ns *linuxNs) ExecIn(container *libcontainer.Container, nspid int, args []string) (int, error) {
ns.logger.Println("unshare namespaces")
for _, ns := range container.Namespaces {
if err := system.Unshare(ns.Value); err != nil {
return -1, err
for _, nsv := range container.Namespaces {
// skip the PID namespace on unshare because it it not supported
if nsv.Key != "NEWPID" {
if err := system.Unshare(nsv.Value); err != nil {
return -1, err
}
}
}
fds, err := ns.getNsFds(nspid, container)
Expand Down

0 comments on commit 4b1513f

Please sign in to comment.