1
0
mirror of https://github.com/docker/cli.git synced 2026-01-26 15:41:42 +03:00

introduce —workdir option for docker exec

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof
2017-12-01 08:26:18 +01:00
parent 6b63d7b96a
commit 591a1273fd
5 changed files with 21 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ type execOptions struct {
user string
privileged bool
env opts.ListOpts
workdir string
container string
command []string
}
@@ -57,6 +58,7 @@ func NewExecCommand(dockerCli command.Cli) *cobra.Command {
flags.StringVarP(&options.user, "user", "u", "", "Username or UID (format: <name|uid>[:<group|gid>])")
flags.BoolVarP(&options.privileged, "privileged", "", false, "Give extended privileges to the command")
flags.VarP(&options.env, "env", "e", "Set environment variables")
flags.StringVarP(&options.workdir, "workdir", "w", "", "Working directory inside the container")
flags.SetAnnotation("env", "version", []string{"1.25"})
return cmd
@@ -190,6 +192,7 @@ func parseExec(opts execOptions, configFile *configfile.ConfigFile) *types.ExecC
Cmd: opts.command,
Detach: opts.detach,
Env: opts.env.GetAll(),
WorkingDir: opts.workdir,
}
// If -d is not set, attach to everything by default