| ... | ... |
@@ -230,5 +230,6 @@ func createCommand(container *libcontainer.Container, console, logFile string, p |
| 230 | 230 |
command.SysProcAttr = &syscall.SysProcAttr{
|
| 231 | 231 |
Cloneflags: uintptr(getNamespaceFlags(container.Namespaces)), |
| 232 | 232 |
} |
| 233 |
+ command.Env = container.Env |
|
| 233 | 234 |
return command |
| 234 | 235 |
} |
| ... | ... |
@@ -12,6 +12,7 @@ import ( |
| 12 | 12 |
"io/ioutil" |
| 13 | 13 |
"log" |
| 14 | 14 |
"os" |
| 15 |
+ "os/exec" |
|
| 15 | 16 |
"path/filepath" |
| 16 | 17 |
"syscall" |
| 17 | 18 |
) |
| ... | ... |
@@ -80,8 +81,13 @@ func Init(container *libcontainer.Container, uncleanRootfs, console string, pipe |
| 80 | 80 |
return fmt.Errorf("chdir to %s %s", container.WorkingDir, err)
|
| 81 | 81 |
} |
| 82 | 82 |
} |
| 83 |
- log.Printf("execing %s goodbye", args[0])
|
|
| 84 |
- if err := system.Exec(args[0], args[0:], container.Env); err != nil {
|
|
| 83 |
+ name, err := exec.LookPath(args[0]) |
|
| 84 |
+ if err != nil {
|
|
| 85 |
+ return err |
|
| 86 |
+ } |
|
| 87 |
+ |
|
| 88 |
+ log.Printf("execing %s goodbye", name)
|
|
| 89 |
+ if err := system.Exec(name, args[0:], container.Env); err != nil {
|
|
| 85 | 90 |
return fmt.Errorf("exec %s", err)
|
| 86 | 91 |
} |
| 87 | 92 |
panic("unreachable")
|