Merge pull request #3551 from crosbymichael/default-env
Remove the process default ENV
This commit is contained in:
commit
c6da899e2f
@ -141,7 +141,6 @@ func populateDefaultUnixSpec(ctx context.Context, s *Spec, id string) error {
|
|||||||
Path: defaultRootfsPath,
|
Path: defaultRootfsPath,
|
||||||
},
|
},
|
||||||
Process: &specs.Process{
|
Process: &specs.Process{
|
||||||
Env: defaultUnixEnv,
|
|
||||||
Cwd: "/",
|
Cwd: "/",
|
||||||
NoNewPrivileges: true,
|
NoNewPrivileges: true,
|
||||||
User: specs.User{
|
User: specs.User{
|
||||||
|
@ -151,6 +151,13 @@ func WithEnv(environmentVariables []string) SpecOpts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithDefaultPathEnv sets the $PATH environment variable to the
|
||||||
|
// default PATH defined in this package.
|
||||||
|
func WithDefaultPathEnv(_ context.Context, _ Client, _ *containers.Container, s *Spec) error {
|
||||||
|
s.Process.Env = replaceOrAppendEnvValues(s.Process.Env, defaultUnixEnv)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// replaceOrAppendEnvValues returns the defaults with the overrides either
|
// replaceOrAppendEnvValues returns the defaults with the overrides either
|
||||||
// replaced by env key or appended to the list
|
// replaced by env key or appended to the list
|
||||||
func replaceOrAppendEnvValues(defaults, overrides []string) []string {
|
func replaceOrAppendEnvValues(defaults, overrides []string) []string {
|
||||||
|
Loading…
Reference in New Issue
Block a user