Skip to content

Commit

Permalink
Merge pull request #3565 from estesp/cp-3551
Browse files Browse the repository at this point in the history
[release/1.2] cherry-pick: Remove the process default ENV
  • Loading branch information
fuweid committed Aug 21, 2019
2 parents de8fa9b + 1c309d8 commit 5e060c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion oci/spec.go
Expand Up @@ -141,7 +141,6 @@ func populateDefaultUnixSpec(ctx context.Context, s *Spec, id string) error {
Path: defaultRootfsPath,
},
Process: &specs.Process{
Env: defaultUnixEnv,
Cwd: "/",
NoNewPrivileges: true,
User: specs.User{
Expand Down
7 changes: 7 additions & 0 deletions oci/spec_opts.go
Expand Up @@ -137,6 +137,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
// replaced by env key or appended to the list
func replaceOrAppendEnvValues(defaults, overrides []string) []string {
Expand Down

0 comments on commit 5e060c4

Please sign in to comment.