diff options
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r-- | libpod/container_internal.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go index d8002b000..28f7dfe45 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -909,7 +909,18 @@ func (c *Container) generateSpec() (*spec.Spec, error) { g.SetHostname(c.Hostname()) g.AddProcessEnv("HOSTNAME", g.Spec().Hostname) - g.AddProcessEnv("container", "libpod") + + // Only add container environment variable if not already present + foundContainerEnv := false + for _, env := range g.Spec().Process.Env { + if strings.HasPrefix(env, "container=") { + foundContainerEnv = true + break + } + } + if !foundContainerEnv { + g.AddProcessEnv("container", "libpod") + } return g.Spec(), nil } |