-
Notifications
You must be signed in to change notification settings - Fork 510
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
Unable to Use Authentication Against Registries Using kubernetes driver #3012
Comments
The registry credentials are loaded on the client side, so on the environment where you call |
@tonistiigi just to clarify, when I call docker buildx on the client side using the kubernetes driver, it creates a buildkit pod which the build runs on. You are saying that if I authenticate on the client those credentials are used inside the buildkit pod that is created, correct? |
Yes, credentials are on the client side. If buildkit inside k8s needs to authenticate against a registry it will call back to client. Client will ask registry auth service for a temporary token for the required repo and scope(push/pull) using your credentials and then send that token to buildkit daemon. You will see smth like
In progress stream when client sends a token to buildkit daemon. |
@tonistiigi ok, makes sense, but what I don't understand is how this works if there are separate repositories. Example: Docker file pulls from docker.io to create a new image, and then docker buildx pushes the image to a private registry Currently, we are authenticating against our private registry prior to running docker buildx build. So really there are two separate repositories that require credentials, our private registry (for pushing) and the docker.io registry (for pulling). |
Docker config file does not support different credentials per repository. Only one set per registry hostname. The tokens are still scoped by repository so buildx will create a separate token for each image and send it to buildkit daemon(in k8s) but if all these images are from Docker Hub then all token will be created based on the same credentials. |
Contributing guidelines
I've found a bug and checked that ...
Description
I have build agents running in Kubernetes. When they run a build, it uses docker buildx create using the kubernetes drive, and then docker buildx build to run the build.
I ran into some issues because it was using anonymous authentication against Docker.io. The limit is 100 per 6 hours. My goal is to have buildkit authenticate against Docker.Io so there is no rate limit (using our licensed user and API auth token).
What I did:
I see:
Prior to running the build, I obtain the rate limit and print it in the build logs (which uses Anonymous auth):
What I observe is that after each build, the ratelmit decreases indicating it is using the Anonymous authentication.
I have also tried creating a .toml config file and passing it in with --config:
Using docker buiildx inspect to confirm that it is being passed and validating in /etc/ folder that the .toml file with the expected name is there and has the expected values.
Maybe I'm doing something wrong, most likely, but I am out of ideas. It seems that buildkit does not adhere to any sort of authentication provided.
Added information:
I would also add that the creation of the buildkit pod (which also pulls from docker.io is NOT a problem). In this case, I've created a K8S secret in the buildkit namespace and added a pullsecret to the default service account in the buildkit namespace. I know this works because we were at a point where the rate limit was 0 and adding this immediately began working. But that only helps for the buildkit pod, not the builds within the buildkit pod.
Expected behaviour
Authentication against registry using provided credentials
Actual behaviour
Ignores provided authentication and defaults to Anonymous authentication, which is limited to 100 pulls per 6 hours.
Buildx version
github.com/docker/buildx v0.20.0 8e30c46
Docker info
Builders list
Configuration
Dockerfile can is not anything special.
Build logs
Additional info
No response
The text was updated successfully, but these errors were encountered: