parseExec parses the specified args for the specified command and generates an ExecConfig from it.
(execOpts ExecOptions, configFile *configfile.ConfigFile)
| 220 | // parseExec parses the specified args for the specified command and generates |
| 221 | // an ExecConfig from it. |
| 222 | func parseExec(execOpts ExecOptions, configFile *configfile.ConfigFile) (*client.ExecCreateOptions, error) { |
| 223 | execOptions := &client.ExecCreateOptions{ |
| 224 | User: execOpts.User, |
| 225 | Privileged: execOpts.Privileged, |
| 226 | TTY: execOpts.TTY, |
| 227 | Cmd: execOpts.Command, |
| 228 | WorkingDir: execOpts.Workdir, |
| 229 | } |
| 230 | |
| 231 | // collect all the environment variables for the container |
| 232 | var err error |
| 233 | if execOptions.Env, err = opts.ReadKVEnvStrings(execOpts.EnvFile.GetSlice(), execOpts.Env.GetSlice()); err != nil { |
| 234 | return nil, err |
| 235 | } |
| 236 | |
| 237 | // If -d is not set, attach to everything by default |
| 238 | if !execOpts.Detach { |
| 239 | execOptions.AttachStdout = true |
| 240 | execOptions.AttachStderr = true |
| 241 | if execOpts.Interactive { |
| 242 | execOptions.AttachStdin = true |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | if execOpts.DetachKeys != "" { |
| 247 | execOptions.DetachKeys = execOpts.DetachKeys |
| 248 | } else { |
| 249 | execOptions.DetachKeys = configFile.DetachKeys |
| 250 | } |
| 251 | if err := validateDetachKeys(execOpts.DetachKeys); err != nil { |
| 252 | return nil, err |
| 253 | } |
| 254 | return execOptions, nil |
| 255 | } |
searching dependent graphs…