From 08318b1ab952e8c30908a9bd2855466d5bbe0ad9 Mon Sep 17 00:00:00 2001 From: "zhangyadong.0808" Date: Tue, 9 Feb 2021 06:12:47 +0800 Subject: [PATCH] cri: append envs from image config to empty slice to avoid env lost Signed-off-by: Yadong Zhang --- pkg/cri/server/container_create_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cri/server/container_create_linux.go b/pkg/cri/server/container_create_linux.go index 26a3cd6d2..992da802c 100644 --- a/pkg/cri/server/container_create_linux.go +++ b/pkg/cri/server/container_create_linux.go @@ -161,7 +161,7 @@ func (c *criService) containerSpec( // 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()) }