Only unshare the mount namespace for execin

Fixes #4728
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)

Conflicts:
	pkg/libcontainer/nsinit/execin.go:
	  ns.logger.Println("unshare namespaces")' was removed already
This commit is contained in:
Michael Crosby
2014-03-17 17:42:16 -07:00
committed by unclejack
parent a2fc45e627
commit b60e316b67
+6 -3
View File
@@ -14,9 +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) {
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)