|
@@ -17,7 +17,9 @@ import (
|
|
"github.com/docker/docker/libcontainerd"
|
|
"github.com/docker/docker/libcontainerd"
|
|
"github.com/docker/docker/pkg/pools"
|
|
"github.com/docker/docker/pkg/pools"
|
|
"github.com/docker/docker/pkg/signal"
|
|
"github.com/docker/docker/pkg/signal"
|
|
|
|
+ "github.com/docker/docker/pkg/system"
|
|
"github.com/docker/docker/pkg/term"
|
|
"github.com/docker/docker/pkg/term"
|
|
|
|
+ "github.com/docker/docker/utils"
|
|
)
|
|
)
|
|
|
|
|
|
// Seconds to wait after sending TERM before trying KILL
|
|
// Seconds to wait after sending TERM before trying KILL
|
|
@@ -121,6 +123,13 @@ func (d *Daemon) ContainerExecCreate(name string, config *types.ExecConfig) (str
|
|
execConfig.Tty = config.Tty
|
|
execConfig.Tty = config.Tty
|
|
execConfig.Privileged = config.Privileged
|
|
execConfig.Privileged = config.Privileged
|
|
execConfig.User = config.User
|
|
execConfig.User = config.User
|
|
|
|
+ execConfig.Env = []string{
|
|
|
|
+ "PATH=" + system.DefaultPathEnv,
|
|
|
|
+ }
|
|
|
|
+ if config.Tty {
|
|
|
|
+ execConfig.Env = append(execConfig.Env, "TERM=xterm")
|
|
|
|
+ }
|
|
|
|
+ execConfig.Env = utils.ReplaceOrAppendEnvValues(execConfig.Env, container.Config.Env)
|
|
if len(execConfig.User) == 0 {
|
|
if len(execConfig.User) == 0 {
|
|
execConfig.User = container.Config.User
|
|
execConfig.User = container.Config.User
|
|
}
|
|
}
|
|
@@ -195,6 +204,7 @@ func (d *Daemon) ContainerExecStart(ctx context.Context, name string, stdin io.R
|
|
|
|
|
|
p := libcontainerd.Process{
|
|
p := libcontainerd.Process{
|
|
Args: append([]string{ec.Entrypoint}, ec.Args...),
|
|
Args: append([]string{ec.Entrypoint}, ec.Args...),
|
|
|
|
+ Env: ec.Env,
|
|
Terminal: ec.Tty,
|
|
Terminal: ec.Tty,
|
|
}
|
|
}
|
|
|
|
|