mirror of
https://github.com/containers/podman.git
synced 2025-05-20 16:47:39 +08:00
Add --unsetenv & --unsetenv-all to remove def environment variables
Podman adds a few environment variables by default, and currently there is no way to get rid of them from your container. This option will allow you to specify which defaults you don't want. --unsetenv-all will remove all default environment variables. Default environment variables can come from podman builtin, containers.conf or from the container image. Fixes: https://github.com/containers/podman/issues/11836 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -709,18 +709,6 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
|
||||
g.AddAnnotation(annotations.ContainerManager, annotations.ContainerManagerLibpod)
|
||||
}
|
||||
|
||||
// Only add container environment variable if not already present
|
||||
foundContainerEnv := false
|
||||
for _, env := range g.Config.Process.Env {
|
||||
if strings.HasPrefix(env, "container=") {
|
||||
foundContainerEnv = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !foundContainerEnv {
|
||||
g.AddProcessEnv("container", "libpod")
|
||||
}
|
||||
|
||||
cgroupPath, err := c.getOCICgroupPath()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user