Exec: Add ability to set environment variables
Keeping the current behavior for exec, i.e., inheriting variables from main process. New variables will be added to current ones. If there's already a variable with that name it will be overwritten. Example of usage: docker exec -it -e TERM=vt100 <container> top Closes #24355. Signed-off-by: Jonh Wendell <jonh.wendell@redhat.com> Upstream-commit: e03bf1221ee2c863f25a57af4d415e2d8ff4f26c Component: engine
This commit is contained in:
@ -45,7 +45,7 @@ func (clnt *client) AddProcess(ctx context.Context, containerID, processFriendly
|
||||
sp := spec.Process
|
||||
sp.Args = specp.Args
|
||||
sp.Terminal = specp.Terminal
|
||||
if specp.Env != nil {
|
||||
if len(specp.Env) > 0 {
|
||||
sp.Env = specp.Env
|
||||
}
|
||||
if specp.Cwd != nil {
|
||||
|
||||
Reference in New Issue
Block a user