From d9ff9095f5d3f665c7789c4fe04d15797c608308 Mon Sep 17 00:00:00 2001 From: Toshiki Shimomura Date: Mon, 1 Apr 2024 09:35:37 +0000 Subject: [PATCH] Keep readonly mounted config.json --- envbuilder.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/envbuilder.go b/envbuilder.go index e9bf5bb9..7ae8936f 100644 --- a/envbuilder.go +++ b/envbuilder.go @@ -772,9 +772,11 @@ func Run(ctx context.Context, options Options) error { unsetOptionsEnv() // Remove the Docker config secret file! - err = os.Remove(filepath.Join(os.Getenv("DOCKER_CONFIG"), "config.json")) - if err != nil && !os.IsNotExist(err) { - return fmt.Errorf("remove docker config: %w", err) + if options.DockerConfigBase64 != "" { + err = os.Remove(filepath.Join(MagicDir, "config.json")) + if err != nil && !os.IsNotExist(err) { + return fmt.Errorf("remove docker config: %w", err) + } } environ, err := os.ReadFile("/etc/environment")