mirror of https://github.com/containers/podman.git
Merge pull request #4677 from baude/execenvfile
allow exec to read files of environment variables
This commit is contained in:
commit
f81f15f422
|
@ -128,6 +128,7 @@ type ExecValues struct {
|
||||||
PodmanCommand
|
PodmanCommand
|
||||||
DetachKeys string
|
DetachKeys string
|
||||||
Env []string
|
Env []string
|
||||||
|
EnvFile []string
|
||||||
Privileged bool
|
Privileged bool
|
||||||
Interactive bool
|
Interactive bool
|
||||||
Tty bool
|
Tty bool
|
||||||
|
|
|
@ -40,6 +40,7 @@ func init() {
|
||||||
// priority
|
// priority
|
||||||
execCommand.DetachKeys = ""
|
execCommand.DetachKeys = ""
|
||||||
flags.StringArrayVarP(&execCommand.Env, "env", "e", []string{}, "Set environment variables")
|
flags.StringArrayVarP(&execCommand.Env, "env", "e", []string{}, "Set environment variables")
|
||||||
|
flags.StringSliceVar(&execCommand.EnvFile, "env-file", []string{}, "Read in a file of environment variables")
|
||||||
flags.BoolVarP(&execCommand.Interactive, "interactive", "i", false, "Keep STDIN open even if not attached")
|
flags.BoolVarP(&execCommand.Interactive, "interactive", "i", false, "Keep STDIN open even if not attached")
|
||||||
flags.BoolVarP(&execCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
|
flags.BoolVarP(&execCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
|
||||||
flags.BoolVar(&execCommand.Privileged, "privileged", false, "Give the process extended Linux capabilities inside the container. The default is false")
|
flags.BoolVar(&execCommand.Privileged, "privileged", false, "Give the process extended Linux capabilities inside the container. The default is false")
|
||||||
|
@ -48,6 +49,7 @@ func init() {
|
||||||
|
|
||||||
flags.IntVar(&execCommand.PreserveFDs, "preserve-fds", 0, "Pass N additional file descriptors to the container")
|
flags.IntVar(&execCommand.PreserveFDs, "preserve-fds", 0, "Pass N additional file descriptors to the container")
|
||||||
flags.StringVarP(&execCommand.Workdir, "workdir", "w", "", "Working directory inside the container")
|
flags.StringVarP(&execCommand.Workdir, "workdir", "w", "", "Working directory inside the container")
|
||||||
|
markFlagHiddenForRemoteClient("env-file", flags)
|
||||||
markFlagHiddenForRemoteClient("latest", flags)
|
markFlagHiddenForRemoteClient("latest", flags)
|
||||||
markFlagHiddenForRemoteClient("preserve-fds", flags)
|
markFlagHiddenForRemoteClient("preserve-fds", flags)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1359,6 +1359,7 @@ _podman_exec() {
|
||||||
--detach-keys
|
--detach-keys
|
||||||
-e
|
-e
|
||||||
--env
|
--env
|
||||||
|
--env-file
|
||||||
--user
|
--user
|
||||||
-u
|
-u
|
||||||
--workdir
|
--workdir
|
||||||
|
|
|
@ -22,6 +22,10 @@ Specify the key sequence for detaching a container. Format is a single character
|
||||||
You may specify arbitrary environment variables that are available for the
|
You may specify arbitrary environment variables that are available for the
|
||||||
command to be executed.
|
command to be executed.
|
||||||
|
|
||||||
|
**--env-file**=*file*
|
||||||
|
|
||||||
|
Read in a line delimited file of environment variables.
|
||||||
|
|
||||||
**--interactive**, **-i**=*true|false*
|
**--interactive**, **-i**=*true|false*
|
||||||
|
|
||||||
When set to true, keep stdin open even if not attached. The default is *false*.
|
When set to true, keep stdin open even if not attached. The default is *false*.
|
||||||
|
|
|
@ -1024,7 +1024,7 @@ func (r *LocalRuntime) ExecContainer(ctx context.Context, cli *cliconfig.ExecVal
|
||||||
|
|
||||||
// Validate given environment variables
|
// Validate given environment variables
|
||||||
env := map[string]string{}
|
env := map[string]string{}
|
||||||
if err := parse.ReadKVStrings(env, []string{}, cli.Env); err != nil {
|
if err := parse.ReadKVStrings(env, cli.EnvFile, cli.Env); err != nil {
|
||||||
return ec, errors.Wrapf(err, "unable to process environment variables")
|
return ec, errors.Wrapf(err, "unable to process environment variables")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue