Failed to push to harbor registry: 401 Unauthorized

Open
#3,569 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
docker, dockerfile, go, kubernetes

Research direction

Reproduce the build with the Kubernetes deployment example, buildctl v0.11.2, the mounted config.json, and the two Harbor project credentials. Inspect how credentials are selected across the Dockerfile pull and final image push; done means project-a pulls and project-b pushes consistently without intermittent 401 responses.

Written by the indexing model from the issue text.

Description

I'm trying to build and push images to harbor registry.

Problem

I have 2 credentials that are mounted on the client side pod in the same config.json which points to 2 different projects in a harbor registry e.g.

  • harbor.xxxxx/project-a - common project used to store base images used by other images
  • harbor.xxxxx/project-b - used to push to image to specific project

My dockerfile looks as such:

FROM harbor.xxxx/project-a/notebook-server/jupyter:latest

ARG PYTHON_VERSION

RUN conda create -n launch-nb python=$PYTHON_VERSION ipykernel ipython_genutils

I need to be able to pull the harbor.xxxx/project-a/notebook-server/jupyter:latest image in the first layer of the Dockerfile and once built i need to push the image to harbor.xxxx/project-b/nb/jupyter-custom:abcd.

Every few runs i hit the following error (sometimes the push is successful):

#12 exporting to image
#12 pushing layers 0.1s done
#12 ERROR: failed to push harbor.xxxx/project-b/nb/jupyter-custom:abcd: unexpected status: 401 Unauthorized
------
 > exporting to image:
------
error: failed to solve: failed to push harbor.xxxx/project-b/nb/jupyter-custom:abcd: unexpected status: 401 Unauthorized

Expected result

Buildctl should check all credentials before returning the 401 Unauthorized error.

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

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.

More from moby/buildkit

All issues in moby/buildkit

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.