diff --git a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/engine_functions/docker_config_storage_creator/docker_config_storage_creator.go b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/engine_functions/docker_config_storage_creator/docker_config_storage_creator.go index 47a4ffd962..e5a22cfa36 100644 --- a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/engine_functions/docker_config_storage_creator/docker_config_storage_creator.go +++ b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/engine_functions/docker_config_storage_creator/docker_config_storage_creator.go @@ -114,9 +114,12 @@ func storeConfigInVolume( for _, registry := range registries { creds, err := docker_manager.GetAuthFromDockerConfig(registry) if err != nil { - return stacktrace.NewError("An error occurred getting auth for registry '%v' from Docker config: %v", registry, err) + logrus.Warnf("An error occurred getting auth for registry '%v' from Docker config: %v", registry, err) + } + // creds can be nil if the registry doesn't have auth + if err != nil && creds != nil { + cfg.Auths[registry] = *creds } - cfg.Auths[registry] = *creds } cfgJsonStr, err := json.Marshal(cfg) diff --git a/container-engine-lib/lib/backend_impls/docker/docker_manager/docker_auth_test.go b/container-engine-lib/lib/backend_impls/docker/docker_manager/docker_auth_test.go index 1f328911e2..6e11673768 100644 --- a/container-engine-lib/lib/backend_impls/docker/docker_manager/docker_auth_test.go +++ b/container-engine-lib/lib/backend_impls/docker/docker_manager/docker_auth_test.go @@ -27,6 +27,12 @@ func writeStaticConfig(t *testing.T, configContent string) string { return tmpDir } +func TestGetAuthWithNoAuthSetReturnsNilAndNoError(t *testing.T) { + authConfig, err := GetAuthFromDockerConfig("my-repo/my-image:latest") + assert.NoError(t, err) + assert.Nil(t, authConfig, "Auth config should be nil") +} + func TestGetAuthConfigForRepoPlain(t *testing.T) { expectedUser := "user" expectedPassword := "password"