aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorAditya R <arajan@redhat.com>2022-08-24 11:22:33 +0530
committerAditya R <arajan@redhat.com>2022-08-24 14:06:25 +0530
commitb4584ea8546be227c74174130ec3a04a93996d28 (patch)
treea18b2250fbbbc64f297415df7e27b37c2e659352 /cmd
parent2538bea8da2a4dba96f1c80594a66f6319d2d872 (diff)
downloadpodman-b4584ea8546be227c74174130ec3a04a93996d28.tar.gz
podman-b4584ea8546be227c74174130ec3a04a93996d28.tar.bz2
podman-b4584ea8546be227c74174130ec3a04a93996d28.zip
run,create: add support for --env-merge for preprocessing vars
Allow end users to preprocess default environment variables before injecting them into container using `--env-merge` Usage ``` podman run -it --rm --env-merge some=${some}-edit --env-merge some2=${some2}-edit2 myimage sh ``` Closes: https://github.com/containers/podman/issues/15288 Signed-off-by: Aditya R <arajan@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/common/create.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go
index 00873b95b..1e573cc2d 100644
--- a/cmd/podman/common/create.go
+++ b/cmd/podman/common/create.go
@@ -124,6 +124,14 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
"This is a Docker specific option and is a NOOP",
)
+ envMergeFlagName := "env-merge"
+ createFlags.StringArrayVar(
+ &cf.EnvMerge,
+ envMergeFlagName, []string{},
+ "Preprocess environment variables from image before injecting them into the container",
+ )
+ _ = cmd.RegisterFlagCompletionFunc(envMergeFlagName, completion.AutocompleteNone)
+
envFlagName := "env"
createFlags.StringArrayP(
envFlagName, "e", Env(),