Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

[release/1.4] append envs from image config to empty slice to avoid env lost #1628

Merged
merged 2 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/server/container_create_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (c *criService) containerSpec(id string, sandboxID string, sandboxPid uint3

// Apply envs from image config first, so that envs from container config
// can override them.
env := imageConfig.Env
env := append([]string{}, imageConfig.Env...)
for _, e := range config.GetEnvs() {
env = append(env, e.GetKey()+"="+e.GetValue())
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/container_create_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (c *criService) containerSpec(id string, sandboxID string, sandboxPid uint3

// Apply envs from image config first, so that envs from container config
// can override them.
env := imageConfig.Env
env := append([]string{}, imageConfig.Env...)
for _, e := range config.GetEnvs() {
env = append(env, e.GetKey()+"="+e.GetValue())
}
Expand Down