Skip to content

Commit c6da899

Browse files
authored
Merge pull request #3551 from crosbymichael/default-env
Remove the process default ENV
2 parents c537c89 + 7379fa6 commit c6da899

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

oci/spec.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ func populateDefaultUnixSpec(ctx context.Context, s *Spec, id string) error {
141141
Path: defaultRootfsPath,
142142
},
143143
Process: &specs.Process{
144-
Env: defaultUnixEnv,
145144
Cwd: "/",
146145
NoNewPrivileges: true,
147146
User: specs.User{

oci/spec_opts.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ func WithEnv(environmentVariables []string) SpecOpts {
151151
}
152152
}
153153

154+
// WithDefaultPathEnv sets the $PATH environment variable to the
155+
// default PATH defined in this package.
156+
func WithDefaultPathEnv(_ context.Context, _ Client, _ *containers.Container, s *Spec) error {
157+
s.Process.Env = replaceOrAppendEnvValues(s.Process.Env, defaultUnixEnv)
158+
return nil
159+
}
160+
154161
// replaceOrAppendEnvValues returns the defaults with the overrides either
155162
// replaced by env key or appended to the list
156163
func replaceOrAppendEnvValues(defaults, overrides []string) []string {

0 commit comments

Comments
 (0)