Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Nicolas De Loof authored on 2017/12/01 17:06:07... | ... |
@@ -7269,6 +7269,9 @@ paths: |
7269 | 7269 |
User: |
7270 | 7270 |
type: "string" |
7271 | 7271 |
description: "The user, and optionally, group to run the exec process inside the container. Format is one of: `user`, `user:group`, `uid`, or `uid:gid`." |
7272 |
+ WorkingDir: |
|
7273 |
+ type: "string" |
|
7274 |
+ description: "The working directory for the exec process inside the container." |
|
7272 | 7275 |
example: |
7273 | 7276 |
AttachStdin: false |
7274 | 7277 |
AttachStdout: true |
... | ... |
@@ -122,6 +122,7 @@ func (d *Daemon) ContainerExecCreate(name string, config *types.ExecConfig) (str |
122 | 122 |
execConfig.Tty = config.Tty |
123 | 123 |
execConfig.Privileged = config.Privileged |
124 | 124 |
execConfig.User = config.User |
125 |
+ execConfig.WorkingDir = config.WorkingDir |
|
125 | 126 |
|
126 | 127 |
linkedEnv, err := d.setupLinkedContainers(cntr) |
127 | 128 |
if err != nil { |
... | ... |
@@ -131,6 +132,9 @@ func (d *Daemon) ContainerExecCreate(name string, config *types.ExecConfig) (str |
131 | 131 |
if len(execConfig.User) == 0 { |
132 | 132 |
execConfig.User = cntr.Config.User |
133 | 133 |
} |
134 |
+ if len(execConfig.WorkingDir) == 0 { |
|
135 |
+ execConfig.WorkingDir = cntr.Config.WorkingDir |
|
136 |
+ } |
|
134 | 137 |
|
135 | 138 |
d.registerExecCommand(cntr, execConfig) |
136 | 139 |
|
... | ... |
@@ -211,7 +215,7 @@ func (d *Daemon) ContainerExecStart(ctx context.Context, name string, stdin io.R |
211 | 211 |
Args: append([]string{ec.Entrypoint}, ec.Args...), |
212 | 212 |
Env: ec.Env, |
213 | 213 |
Terminal: ec.Tty, |
214 |
- Cwd: c.Config.WorkingDir, |
|
214 |
+ Cwd: ec.WorkingDir, |
|
215 | 215 |
} |
216 | 216 |
if p.Cwd == "" { |
217 | 217 |
p.Cwd = "/" |