summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-11-16 16:27:34 +0100
committerGitHub <noreply@github.com>2021-11-16 16:27:34 +0100
commitf031bd23c6f5f790dde383d542c940bfe2dfaadd (patch)
tree34d460f57b3ecf7491ec92a296ebd68e233e8bf6 /cmd/podman
parent8430ffc72e74f1271174984674a1c2ee6118779e (diff)
parent44d1618dd7eeb2560571b14ba5cece69a93dcaff (diff)
downloadpodman-f031bd23c6f5f790dde383d542c940bfe2dfaadd.tar.gz
podman-f031bd23c6f5f790dde383d542c940bfe2dfaadd.tar.bz2
podman-f031bd23c6f5f790dde383d542c940bfe2dfaadd.zip
Merge pull request #12100 from rhatdan/env
Add option --unsetenv to remove default environment variables
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/common/create.go14
-rw-r--r--cmd/podman/common/create_opts.go2
2 files changed, 16 insertions, 0 deletions
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go
index 4598e535d..d73fa653f 100644
--- a/cmd/podman/common/create.go
+++ b/cmd/podman/common/create.go
@@ -201,6 +201,20 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
)
_ = cmd.RegisterFlagCompletionFunc(envFlagName, completion.AutocompleteNone)
+ unsetenvFlagName := "unsetenv"
+ createFlags.StringArrayVar(
+ &cf.UnsetEnv,
+ unsetenvFlagName, []string{},
+ "Unset environment default variables in container",
+ )
+ _ = cmd.RegisterFlagCompletionFunc(unsetenvFlagName, completion.AutocompleteNone)
+
+ createFlags.BoolVar(
+ &cf.UnsetEnvAll,
+ "unsetenv-all", false,
+ "Unset all default environment variables in container",
+ )
+
if !registry.IsRemote() {
createFlags.BoolVar(
&cf.EnvHost,
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go
index 6283eb28e..aacdfd274 100644
--- a/cmd/podman/common/create_opts.go
+++ b/cmd/podman/common/create_opts.go
@@ -297,6 +297,8 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, rtc *c
Systemd: "true", // podman default
TmpFS: parsedTmp,
TTY: cc.Config.Tty,
+ UnsetEnv: cc.UnsetEnv,
+ UnsetEnvAll: cc.UnsetEnvAll,
User: cc.Config.User,
UserNS: string(cc.HostConfig.UsernsMode),
UTS: string(cc.HostConfig.UTSMode),