Fix execin with environment and Enabled support

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: aa9705f832d847d6e6ce76e19f3c952c194c167e
Component: engine
This commit is contained in:
Michael Crosby
2014-04-30 18:24:47 -07:00
parent 4b320ae74d
commit c0992a66d2
@@ -17,9 +17,15 @@ import (
// ExecIn uses an existing pid and joins the pid's namespaces with the new command.
func ExecIn(container *libcontainer.Container, nspid int, args []string) (int, error) {
// clear the current processes env and replace it with the environment
// defined on the container
if err := LoadContainerEnvironment(container); 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 nsv.Enabled && nsv.Key != "NEWPID" {
if err := system.Unshare(nsv.Value); err != nil {
return -1, err
}