-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker build
fails to authenticate with private repository
#1613
Comments
@crazy-max @jedevc PTAL; at a glance I don't see |
@alexhendel out of curiosity, if you run with |
Actually shows the same result. ~/source/docker-test$ sudo docker buildx build .
[+] Building 0.1s (3/3) FINISHED
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 100B 0.0s
=> ERROR [internal] load metadata for ***/moembed/runtime:4.0.0-arm64v8 0.1s
------
> [internal] load metadata for ***/moembed/runtime:4.0.0-arm64v8:
------
Dockerfile:1
--------------------
1 | >>> FROM ***/moembed/runtime:4.0.0-arm64v8
2 | CMD echo
3 |
--------------------
ERROR: failed to solve: ***/moembed/runtime:4.0.0-arm64v8: pulling from host *** failed with status code [manifests 4.0.0-arm64v8]: 401 Unauthorized
~/source/docker-test$ sudo docker pull ***/moembed/runtime:4.0.0-arm64v8
4.0.0-arm64v8: Pulling from moembed/runtime
Digest: sha256:2fac5f0e2e94fbd4d03658b7f8aa840a7c6089bfe0ad4ceffd055ea0d649ffe2
Status: Downloaded newer image for ***/moembed/runtime:4.0.0-arm64v8
***/moembed/runtime:4.0.0-arm64v8
~/source/docker-test$ sudo docker buildx build .
[+] Building 0.0s (5/5) FINISHED
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 100B 0.0s
=> [internal] load metadata for ***/moembed/runtime:4.0.0-arm64v8 0.0s
=> CACHED [1/1] FROM ***/moembed/runtime:4.0.0-arm64v8 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:a48d05fdcf8e508d0a8114f132f5ab2e4790e28ed425638a2ac04a0ee212b92 |
@alexhendel what does your |
The config json below (I replaced the actual values with ***): The registry value is what I would expect and the auth value appears to be hashed string. {
"auths": {
"***": {
"auth": "***"
}
}
} |
Thanks! Yes, that looks fairly standard (was curious if perhaps a credential-helper was in use somewhere). Do you happen to know what kind of registry is running on your |
@thaJeztah sounds good to move to buildx repo 🎉 |
Done! |
Are you using a remote server and is it possible the registry does additional authentication based on IP? If yes, does setting
Is this a clean domain like in the reference you are pulling, or URL with some protocol/path? |
We are using Sonatype Nexus to host a private registry. I am not sure about the IP-based authentication. Where would I configure
This value is a clean domain. No path or protocol. |
We did some additional testing which might give some more details. We did try podman and ran: podman pull
podman build . This behaves like the previous Docker version, build and pull work fine. Checking the network traffic the only difference we could find was an additional HEAD request with v23 (which was not sent previously and is also not sent by podman). |
We have experienced the exactly same issue with docker |
I can confirm that |
@tgquan67 What version of Artifactory are you using? I can't seem to get it to work with Artifactory |
|
So |
No, on the client. |
Yup, that's what I was trying but still no luck. What's odd for me is it does seem like my layers are pushed to my Artifactory successfully, but when it tries to push the manifest then Artifactory responds with a I'll have to update my Artifactory and try again. |
I'm on artifactory 7.41 and it worked. Btw, in my case I only test if it can pull the base image from artifactory, I did not try to push it with buildx. |
No, these seem to be about HTTP request methods, |
I updated my Artifactory to their newest version, but still no luck. However, I did try |
Yup, it was just a permission issue on my Artifactory that caused the |
Now I test it again on docker 24, it works even without |
Same issue here! |
The issue persists on docker 24.0.7 and buildx v0.11.2. |
I'm still seeing this on docker 25.0.3 and buildx v0.12.1 $ docker --version
Docker version 25.0.3, build 4debf41
$ docker buildx version
github.com/docker/buildx v0.12.1-desktop.4 6996841df2f61988c2794d84d33205368f96c317 |
same issue here |
@alexhendel just curious if you ever resolved this on your side? We're using Nexus and facing the same thing. Works with legacy builder, just not BuildKit. |
Another update: at some point after docker 25 update, it started working in my case (artifactory 7.41) with
Create a new builder with
And I also export these 3 variables:
After this in dockerfiles I can pull from |
No not directly. There was an nginx proxy routing our traffic. We did change the nginx config to allow HEAD requests. To us it seems that at some point these HEAD requests where implemented and did not go through with our setup. It did work for our case since. |
In my case guys was a GitHub package permission issue, for fix that go into your package detail ---> package settings ---> and check the package permissions, not sure that this is releated to your problem but maybe can help, after that on my side no more auth errors, the strange thing was the error because was not simila to 401 or 403. |
Same issue with latest docker.
|
@zerowebcorp are you running the |
No. Outside the container. Docker registry hosted remote behind cloudflare. It started working finally when I disabled cloudflare waf. |
Hi, when I run this locally, it works:
However, when I try the same commands inside a Docker container during CI, it fails due to authentication issues. I believe the authentication is fine since a normal Docker push to the same repository works without any problems. |
Description
I have noticed an issue using private repositories with authentication since upgrading to the latest docker version with Docker Engine v23.
Using basic auth (no credential helper)
docker pull
can pull the image from the private repository (Nexus in my case) after runningdocker login
. But runningdocker build .
fails with the following error:Since
docker pull
will pull the image from the private registry afterdocker login
the following steps will lead to a successful build:docker login some.registry.com
docker pull some.registry.com/image
docker build .
I found that the behavior is similar to docker/cli#3716 but only started for me after installing docker with Docker Engine v23.
Reproduce
docker login some.registry.com
Dockerfile
with relevant content (withFROM
clause referring to a private registry image)docker build .
Expected behavior
docker build
should use the given credentials after adocker login
and successfully pull the referenced image from the given registry.docker version
Client: Docker Engine - Community Version: 23.0.0 API version: 1.42 Go version: go1.19.5 Git commit: e92dd87 Built: Wed Feb 1 17:46:28 2023 OS/Arch: linux/arm64 Context: default Server: Docker Engine - Community Engine: Version: 23.0.0 API version: 1.42 (minimum version 1.12) Go version: go1.19.5 Git commit: d7573ab Built: Wed Feb 1 17:46:28 2023 OS/Arch: linux/arm64 Experimental: false containerd: Version: 1.6.16 GitCommit: 31aa4358a36870b21a992d3ad2bef29e1d693bec runc: Version: 1.1.4 GitCommit: v1.1.4-0-g5fd4c4d docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Additional Info
No response
The text was updated successfully, but these errors were encountered: