Error: Failed to Solve: Authorization Status: 401: authorization failed

Hello…

I’ve been trying to build and push docker buildx images using multiple platforms to DockerHub.

sudo docker buildx create --name mybuilder

After successfully creating a builder instance, I then began to run:

sudo docker buildx build --platform linux/amd64,linux/arm64 -t docker.io/xxx/test:test1 --push  .

I’m running into the issue…

=> [1/6] FROM docker.io/library/ubuntu:20.04@sha256:626ffe58f6e7566e00254b638eb7e0f3b11d4da9675088f4781a50ae288f3322                                                                     0.0s
 => => resolve docker.io/library/ubuntu:20.04@sha256:626ffe58f6e7566e00254b638eb7e0f3b11d4da9675088f4781a50ae288f3322                                                                     0.0s
 => CACHED [2/6] RUN apt-get update     &&     DEBIAN_FRONTEND=noninteractive     apt-get install --assume-yes --no-install-recommends         build-essential         ca-certificates    0.0s
 => CACHED [3/6] RUN locale-gen en_US.UTF-8                                                                                                                                               0.0s
 => CACHED [4/6] RUN update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8                                                                                                                    0.0s
 => CACHED [5/6] RUN DEBIAN_FRONTEND=noninteractive     apt-get install --assume-yes --no-install-recommends         iasl                                                                 0.0s
 => CACHED [6/6] RUN rm -rf /var/lib/apt/lists/*                                                                                                                                          0.0s
 => ERROR exporting to image                                                                                                                                                              0.4s
 => => exporting layers                                                                                                                                                                   0.0s
 => => exporting manifest sha256:a53a7a44f3ca8b933e577b5b1b0fce10a02e2718f83c38edd2c2791bc04babe4                                                                                         0.0s
 => => exporting config sha256:1229aaa181cd0ea0b734d919720452adbac53cd5b425ecccda83832569ce6cc9                                                                                           0.0s
 => => pushing layers                                                                                                                                                                     0.3s
------
 > exporting to image:
------
error: failed to solve: authorization status: 401: authorization failed

I have successfully pushed am image using docker push . so I know nothing is wrong on the DockerHub side.

After researching this issue for the past few days, I’ve found a few answers online to fix this but nothing seems to work for me.

I’m currently using:

 Version:           20.10.11
 API version:       1.41
 Go version:        go1.16.9
 Git commit:        dea9396
 Built:             Thu Nov 18 00:37:06 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.11
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.9
  Git commit:       847da18
  Built:            Thu Nov 18 00:35:15 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

And Buildx:
github.com/docker/buildx v0.6.3-docker 266c0eac611d64fcc0c72d80206aa364e826758d

Also, I was able to successfully login to my dockerHub account using CLI. Wondering if anyone has any thoughts to fix this?

Btw… I’m using Ubuntu 20.04 Focal!

Thanks so much!

2 Likes