Multi-arch build using buildx gets stuck at pushing the image to Docker Hub

Hi,
I am trying to build a multi-arch docker image using buildx. I use the following command.

docker buildx build --platform linux/amd64,linux/arm64 -t adityasamantlearnings/customers:v1 --push .

The build proceeds to the step of pushing the image to DockerHub’s remote repository.

At this stage my build hangs showing the logs below, probably due to an authentication issue.

 => => pushing layers                                                                                                                                                    276.4s
 => [auth] adityasamantlearnings/customers:pull,push token for registry-1.docker.io                                                                                        0.0s

It seems to be pointing to the registry-1.docker.io instead of my respository adityasamantlearnings/customers.

My repository exists. I am able to successfully push regular images using docker push with no issues.

Just the push with docker buildx fails.

I have already authenticated my remote repository using docker login

Any idea what could be the issue?

But the remote registry you are using is on Dockerhub. So you use your Dockerhub credentials to push:
adityasamantlearnings’s Profile (docker.com)

I have logged-in to my docker hub registry using docker login by using my docker hub credentials.
Yet the push via buildx gets stuck.

Note that a normal docker push works fine

This works:
docker image push adityasamantlearnings/customers:v1

This get stuck:
docker buildx build --platform linux/amd64,linux/arm64 -t adityasamantlearnings/customers:v1 --push .

I believe the pre-requisite of docker login should be the same for both, right?

Docker login should work for both. I successfully built and push a multi-arch build:

This is my Dockerfile:

FROM ubuntu:22.04
RUN apt-get update && \
    apt-get install -y python3 python3-pip
RUN pip3 install flask
COPY app.py /opt/
WORKDIR /opt
EXPOSE 5000
ENV FLASK_APP=/opt/app.py
ENTRYPOINT ["flask"]
CMD ["run", "--host=0.0.0.0", "--port=5000", "--debugger"]

Check you have an up to date version of docker:

$ docker version
Client: Docker Engine - Community
 Cloud integration: v1.0.35+desktop.5
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.20.7
 Git commit:        ed223bc
 Built:             Mon Sep  4 12:32:16 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Desktop
 Engine:
  Version:          24.0.6
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.7
  Git commit:       1a79695
  Built:            Mon Sep  4 12:32:16 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.22
  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
 runc:
  Version:          1.1.8
  GitCommit:        v1.1.8-0-g82f18fe
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

This is the command I ran to build and push:

docker buildx build --push --platform linux/arm64,linux/amd64 --tag albal/multiarch-example:buildx-latest .

But before that I had to enable the platforms:

docker buildx create --use --platform=linux/arm64,linux/amd64

Also working with current version of Docker Desktop:

$ docker version
Client: Docker Engine - Community
 Cloud integration: v1.0.35+desktop.5
 Version:           24.0.7
 API version:       1.43
 Go version:        go1.20.10
 Git commit:        afdd53b
 Built:             Thu Oct 26 09:08:17 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Desktop
 Engine:
  Version:          24.0.7
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.10
  Git commit:       311b9ff
  Built:            Thu Oct 26 09:08:02 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.25
  GitCommit:        d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f
 runc:
  Version:          1.1.10
  GitCommit:        v1.1.10-0-g18a0cb0
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Thanks, I need to check what is the problem in my configuration as the steps are pretty much the same. Thanks for the inputs, I will try on these lines.

Can you please send me the last two lines of the console output from your successful buildx command?

For me its as follows and I think my problem is that it is trying to authenticate to the default registry1.docker.io instead of my docker account.

=> => pushing layers                                                                                                                                                    276.4s
 => [auth] adityasamantlearnings/customers:pull,push token for registry-1.docker.io                                                                                        0.0s

I have a manifest being pushed too:

 => => pushing layers                                                                                             44.3s
 => => pushing manifest for docker.io/albal/multiarch-example:buildx-latest@sha256:aa37394ca6793f37f47d7ca56aa8ed  2.0s
 => [auth] albal/multiarch-example:pull,push token for registry-1.docker.io

It is working for me now, although I am not sure of the root cause.

I did the following:

  1. Uninstall and reinstall of the Docker Desktop → this did not help.

  2. Created a new auth token for Docker and used docker login with the token instead of password → this did not help initially as well.

After some time, without any further change, the images started being pushed.

So I am not clear on what fixed it, but I don’t have the energy to investigate further on the root cause :wink:

Thanks @al1 for your help !

=> => pushing layers                                                                                                                                                      2.9s
 => => pushing manifest for docker.io/adityasamantlearnings/customers:1.0.0@sha256:c414fd648888790bc6c5465ae349c6733d7c67fd9aa128e9903541b27818df38                        2.4s
 => [auth] adityasamantlearnings/customers:pull,push token for registry-1.docker.io