From 5aa85ab50186114b4c9a08cd12fd0f3b684d1fdf Mon Sep 17 00:00:00 2001 From: Pasha Sviderski Date: Thu, 9 Oct 2025 15:14:10 +1000 Subject: [PATCH] fix(push): always provide encoded empty auth config to work around panic in Docker --- internal/docker/image.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/docker/image.go b/internal/docker/image.go index fb8ba726..25e3dae0 100644 --- a/internal/docker/image.go +++ b/internal/docker/image.go @@ -48,9 +48,16 @@ func (cli *Client) PushImage( ) (<-chan PullPushImageMessage, error) { if opts.RegistryAuth == "" { // Try to retrieve the authentication token for the image from the default local Docker config file. - if encodedAuth, err := RetrieveLocalDockerRegistryAuth(image); err == nil { - opts.RegistryAuth = encodedAuth + encodedAuth, _ := RetrieveLocalDockerRegistryAuth(image) + if encodedAuth == "" { + // If no credentials are found, provide an encoded empty auth config to work around the bug in Docker: + // https://github.com/moby/moby/issues/50729 + var err error + if encodedAuth, err = registry.EncodeAuthConfig(registry.AuthConfig{}); err != nil { + return nil, fmt.Errorf("encode empty auth config: %w", err) + } } + opts.RegistryAuth = encodedAuth } respBody, err := cli.ImagePush(ctx, image, opts)