docker buildx build fails to push to registry with insufficient_scope authorisation failed

4.1k Views Asked by At

I'm using Rancher Desktop on MacBook Pro M1 to build and publish docker images.

Requirement is to build the image for both amd64 and arm64 platforms so I am trying to do this using the following commands:

docker buildx create --name my-app-image-builder --platform linux/arm64,linux/arm/v8


docker buildx build --builder my-app-image-builder --platform linux/amd64,linux/arm64 -o type=registry -t my-app:latest .

The hope is that I can publish the image to the local registry so it can be tested before being promoted. The docker image builds fine, but at the point of publishing the image it fails with:

     [exec] #38 exporting to image
     [exec] #38 exporting layers done
     [exec] #38 exporting manifest sha256:e78442aec2edae5e87fe3cd35cdcc0f66d8040febc1fed5aae6b98a03d20cfe9 done
     [exec] #38 exporting config sha256:073bd50a7bcdbb168aa4667444d10b4941c1e4c645bd6300828e1a8caa27864f done
     [exec] #38 exporting manifest sha256:7fe8dfdd7b5ba6b46a6018c57fdf19b5476fb98e0cb95934a78f5ca68db3f54d done
     [exec] #38 exporting config sha256:43f1ccc2b69eac343d84a25aa4df06c03b49dba2c18f49a7505d61d6bc26a30a done
     [exec] #38 exporting manifest list sha256:3eedf89c68a733854f0bd50a0eefed2858c150a8a73c63bee4a3deab2e5e47ce done
     [exec] #38 pushing layers
     [exec] #38 pushing layers 1.3s done
     [exec] #38 ERROR: server message: insufficient_scope: authorization failed
     [exec] ------
     [exec]  > exporting to image:
     [exec] ------
     [exec] ERROR: failed to solve: server message: insufficient_scope: authorization failed

Version info:

  • Rancher desktop version: 1.6.2
  • macOS Monterey version: 12.6.1
  • Docker version: 20.10.17-rd, build c2e4e01
  • Docker buildx version: github.com/docker/buildx v0.9.1 ed00243a0ce2a0aee75311b06e32d33b44729689

I'm not sure if this is purely me being ignorant or some limitation of Rancher Desktop docker implementation? Any clues/pointers?

1

There are 1 best solutions below

3
On

You don't have access to push images to my-app:latest, same as you don't have access to push a new alpine:latest image. These names, without a registry and username are being pushed to the official images namespace on Docker Hub.

To fix, you need to name your image with a registry and/or repository where you have access to push images. And if that access requires a login, then perform the login first. E.g. you can create a Hub account, and push images to $username/image:latest.