moby / moby/buildkit

docker buildx + registry mirror + dockerhub

Open
#3,919 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
10.3k
Forks
1.5k
Avg merge
1d 21h
Merged PRs (30d)
50

Description

I have an issue when publishing to DockerHub from Google Cloud Build using docker build (buildx by default on docker:24-git).
They automatically setup a registry mirror on : https://mirror.gcr.io/

I build & push to dockerhub with something simple like :
docker build --push -t <ORG>/<IMAGE>:<VERSION>

The image is built and pushed successfully (!), but then docker build fails with :
Error response from daemon: Head "https://mirror.gcr.io/v2/<ORG>/<IMAGE>/manifests/<VERSION>": unauthorized: Not Authorized.

Any idea why their mirror is complaining ?
Could it be that docker pushes the image directly to dockerhub without going through the mirror and then tries to read it again right after using the mirror this time without luck ?

docker info gives this :

Client:
 Version:    24.0.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.5
    Path:     /usr/local/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.18.1
    Path:     /usr/local/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 3
  Running: 2
  Paused: 0
  Stopped: 1
 Images: 107
 Server Version: 20.10.24
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
 runc version: v1.1.7-0-g860f061
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.10.0-22-cloud-amd64
 Operating System: Debian GNU/Linux 11 (bullseye)
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 3.839GiB
 Name: worker-78d47fe7-b010-4125-a789-73baad69ad68
 ID: T6MI:UTSV:5W6X:JUQL:KTJZ:XDPG:T4ES:ZZMT:VFZN:V4NK:44O2:S667
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 46
  Goroutines: 65
  System Time: 2023-05-30T19:31:05.066537598Z
  EventsListeners: 0
 Username: blop
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://mirror.gcr.io/
 Live Restore Enabled: false

Thank you for your help!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report provides a docker build --push reproduction and docker info showing mirror.gcr.io; start by reproducing it in the Google Cloud Build environment and tracing registry requests. Done means determining whether the mirror is incorrectly used for the pushed image and recording a confirmed configuration or behavior fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, google-cloud
Domain
build-system, cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.