diff --git a/cmd/executor/cmd/root.go b/cmd/executor/cmd/root.go index 43ae566df..3f2d05c9a 100644 --- a/cmd/executor/cmd/root.go +++ b/cmd/executor/cmd/root.go @@ -260,6 +260,10 @@ func checkKanikoDir(dir string) error { if err := os.RemoveAll(constants.DefaultKanikoPath); err != nil { return err } + // After remove DefaultKankoPath, the DOKCER_CONFIG env will point to a non-exist dir, so we should update DOCKER_CONFIG env to new dir + if err := os.Setenv("DOCKER_CONFIG", filepath.Join(dir, "/.docker")); err != nil { + return err + } } return nil }