env: don't set "container" env

Leave setting the "container" variable to consumers of pkg/env.
Podman is now hard-setting it to "podman" while "libpod" will
set it internally to "libpod" if it's unset.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2020-03-03 15:29:13 +01:00
parent 34baea814b
commit 6d2d6898f8
2 changed files with 7 additions and 6 deletions

View File

@ -477,7 +477,9 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
//
// Precedence order (higher index wins):
// 1) env-host, 2) image data, 3) env-file, 4) env
var env map[string]string
env := map[string]string{
"container": "podman",
}
// Start with env-host
if c.Bool("env-host") {
@ -485,7 +487,7 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
if err != nil {
return nil, errors.Wrap(err, "error parsing host environment variables")
}
env = osEnv
env = envLib.Join(env, osEnv)
}
// Image data overrides any previous variables

7
pkg/env/env.go vendored
View File

@ -12,11 +12,10 @@ import (
"github.com/pkg/errors"
)
// DefaultEnvVariables set $PATH, $TERM and $container.
// DefaultEnvVariables sets $PATH and $TERM.
var DefaultEnvVariables = map[string]string{
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"TERM": "xterm",
"container": "podman",
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"TERM": "xterm",
}
const whiteSpaces = " \t"