diff --git a/modules/registry/registry.go b/modules/registry/registry.go index cffa8f1803..c3b49ea90a 100644 --- a/modules/registry/registry.go +++ b/modules/registry/registry.go @@ -192,7 +192,7 @@ func (c *RegistryContainer) PushImage(ctx context.Context, ref string) error { return fmt.Errorf("failed to encode image auth: %w", err) } - _, err = dockerCli.ImagePush(ctx, ref, client.ImagePushOptions{ + output, err := dockerCli.ImagePush(ctx, ref, client.ImagePushOptions{ All: true, RegistryAuth: encodedAuth, }) @@ -200,7 +200,16 @@ func (c *RegistryContainer) PushImage(ctx context.Context, ref string) error { return fmt.Errorf("push image %q: %w", ref, err) } - return c.ImageExists(ctx, ref) + for m, err := range output.JSONMessages(ctx) { + if err != nil { + return fmt.Errorf("push image %q: %w", ref, err) + } + if err := m.Error; err != nil { + return fmt.Errorf("push image %q: %w", ref, err) + } + } + + return nil } // PullImage pulls an image from an external registry into the local Docker daemon.