Merge pull request #12100 from rhatdan/env

Add option --unsetenv to remove default environment variables
This commit is contained in:
OpenShift Merge Robot
2021-11-16 16:27:34 +01:00
committed by GitHub
14 changed files with 91 additions and 21 deletions

View File

@ -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