Use lookup path for init
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
e90b85bdc0
commit
b9bc36a8bb
2 changed files with 9 additions and 2 deletions
|
@ -230,5 +230,6 @@ func createCommand(container *libcontainer.Container, console, logFile string, p
|
||||||
command.SysProcAttr = &syscall.SysProcAttr{
|
command.SysProcAttr = &syscall.SysProcAttr{
|
||||||
Cloneflags: uintptr(getNamespaceFlags(container.Namespaces)),
|
Cloneflags: uintptr(getNamespaceFlags(container.Namespaces)),
|
||||||
}
|
}
|
||||||
|
command.Env = container.Env
|
||||||
return command
|
return command
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
@ -80,8 +81,13 @@ func Init(container *libcontainer.Container, uncleanRootfs, console string, pipe
|
||||||
return fmt.Errorf("chdir to %s %s", container.WorkingDir, err)
|
return fmt.Errorf("chdir to %s %s", container.WorkingDir, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Printf("execing %s goodbye", args[0])
|
name, err := exec.LookPath(args[0])
|
||||||
if err := system.Exec(args[0], args[0:], container.Env); err != nil {
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Printf("execing %s goodbye", name)
|
||||||
|
if err := system.Exec(name, args[0:], container.Env); err != nil {
|
||||||
return fmt.Errorf("exec %s", err)
|
return fmt.Errorf("exec %s", err)
|
||||||
}
|
}
|
||||||
panic("unreachable")
|
panic("unreachable")
|
||||||
|
|
Loading…
Reference in a new issue