You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
✨ Provision to define private docker registry at global level #2238
Dagger should standardize the way "image source" is defined for packages. I like the way it is an input in the Go package but it would be nice to be able to specify a private registry at a global level.
How are you currently working around this?
I have to pull the image with #Docker.pull and specify the auth and source to pull images via my private registry because I can't use #Alpine out of the box.
He is still stuck (I showed him an alternative, a solution, but he cannot onboard on the todoApp example as it's too complex to modify everything to make it work for an onboarding start). He was trying out Dagger with the todoApp example:
Working from his company, he was getting the docker hub pull rate limit issue. As the example doesn't permit to easily login, he's basically stuck
It shows a more in-depth issue:
Most of the packages (alpine, netlify, yarn) don't allow to easily add/modify a registry url, and auth credentials, which are often client infos
2 solutions:
design another todoApp, and change most of the universe packages to include that option
Find a system to allow global env var ? It would however break the all host interactions happen in the client API
It would however break the all host interactions happen in the client API
Not at all. It wouldn't be a var available to a CUE action, so it doesn't break client API. It would be something that Go reads during execution of core.#Pull to fill in the auth if needed.
There's no guarantee that alpine relies on pulling an image from docker hub, or any registry at all. In the future it could for example assemble an image from alpine packages by talking to alpine registries directly. Or it could pull from a third-party image registry, unrelated to docker hub.
If we implement a "side-load" to authenticate core.#Pull globally, that has pretty major implications, for example:
Why stop at docker registries? Will we not need to do the same for any action that a) may require authentication, and b) may be wrapped by a higher-level action that does not allow explicit auth override?
What will be the behavior, exactly? Will it be an override, or a default?
I'm still in favor of doing it, but in doubt we should assume it's a short-term stopgap and it may have longer-term design issues. But still think it's worth doing it to alleviate user pain.
The way I suggested it was just to have two settings (e.g., DOCKERHUB_AUTH_USER, DOCKERHUB_AUTH_PASS) to apply in Go if they exist and the image to pull matches the index.docker.io registry, and has no auth.
Since universe actions pull a lot of images from the docker hub, it's very hard to override every image just to add authentication due to the rate limit.
So the scope can be very limited to just docker hub. I don't see any implications coming from this. If you're using some other registry or set of images with universe actions, you're already overriding them and you should already have your own personal/company abstraction for it. At least the most common case of hitting rate limits against the public registry gets a bit better.
If you're pulling alpine through some other means (i.e., not via the docker hub), then this wouldn't apply.
With #Dockerfile and #Push it's different because they're not burried in universe actions. You control those so you can provide an auth. Still, if you have a global auth for docker hub, users may expect them there as well.
I do agree that this is a stopgap. We need a better abstraction because people need generalized auth, mirrors/proxies, etc... in their environments. This is like asking for an equivalent of docker login before doing docker build.
@grouville put the other one here (#2238 (comment)) to fix the case of exceeded rate limiting for the docker hub, but that's different from what the OP's asking:
Provide global setting to change the default registry globally (this issue... has more implications)
Provide global setting with auth for the docker hub registry (should be a different issue)
As for changing the registry like OP's asking, if it's a mirror I think it's ok, but it also opens the door for potentially returning different images from what dagger's expecting (depending on the registry), leading to unexpected behavior and confusion. It has more implications and it's a use case for that better abstraction that we need, but I'm not so sure of doing the same thing as with auth for now.
For the record, another short-term fix that might be better: move away from Docker Hub for default images in universe. Either by moving to a more generous image hosting provider that doesn't mind acting as a free CDN; or building images in such a way that a base image doesn't need to be downloaded again (build from distro packages a-la apko, or even from source). As discussed with @jpadams who will create an issue.
(We should still implement this stopgap. Just noting that we may be able to get rid of it later)
Activity
grouville commentedon Jul 13, 2022
@mircubed @helderco @shykes @jpadams. This issue got encountered again today by the user @calvinxu.
He is still stuck (I showed him an alternative, a solution, but he cannot onboard on the
todoAppexample as it's too complex to modify everything to make it work for an onboarding start). He was trying out Dagger with thetodoAppexample:docker hub pull rate limitissue. As the example doesn't permit to easily login, he's basically stuckIt shows a more in-depth issue:
registry url, andauth credentials, which are often client infos2 solutions:
all host interactions happen in the client APIhelderco commentedon Jul 13, 2022
Not at all. It wouldn't be a var available to a CUE action, so it doesn't break client API. It would be something that Go reads during execution of
core.#Pullto fill in the auth if needed.grouville commentedon Jul 13, 2022
Oh ok. I see your point of view. I can assign this issue to myself and make a PR to solve it, with this solution. Would you be ok @helderco ?
shykes commentedon Jul 13, 2022
I have two problems with this:
There's no guarantee that
alpinerelies on pulling an image from docker hub, or any registry at all. In the future it could for example assemble an image from alpine packages by talking to alpine registries directly. Or it could pull from a third-party image registry, unrelated to docker hub.If we implement a "side-load" to authenticate
core.#Pullglobally, that has pretty major implications, for example:I'm still in favor of doing it, but in doubt we should assume it's a short-term stopgap and it may have longer-term design issues. But still think it's worth doing it to alleviate user pain.
helderco commentedon Jul 13, 2022
The way I suggested it was just to have two settings (e.g.,
DOCKERHUB_AUTH_USER,DOCKERHUB_AUTH_PASS) to apply in Go if they exist and the image to pull matches theindex.docker.ioregistry, and has no auth.Since universe actions pull a lot of images from the docker hub, it's very hard to override every image just to add authentication due to the rate limit.
So the scope can be very limited to just docker hub. I don't see any implications coming from this. If you're using some other registry or set of images with universe actions, you're already overriding them and you should already have your own personal/company abstraction for it. At least the most common case of hitting rate limits against the public registry gets a bit better.
If you're pulling alpine through some other means (i.e., not via the docker hub), then this wouldn't apply.
docker.#Pull & { source: "alpine" }✅docker.#Pull & { source: "registry.gitlab.com/alpine/alpine" }❌docker.#Pull & { source: "alpine", auth: _auth }❌With
#Dockerfileand#Pushit's different because they're not burried in universe actions. You control those so you can provide anauth. Still, if you have a global auth for docker hub, users may expect them there as well.I do agree that this is a stopgap. We need a better abstraction because people need generalized auth, mirrors/proxies, etc... in their environments. This is like asking for an equivalent of
docker loginbefore doingdocker build.shykes commentedon Jul 13, 2022
Sounds good, I don't have anything better to suggest anyway, and doing nothing is not an option... 👍
helderco commentedon Jul 13, 2022
There's two issues here.
@grouville put the other one here (#2238 (comment)) to fix the case of exceeded rate limiting for the docker hub, but that's different from what the OP's asking:
As for changing the registry like OP's asking, if it's a mirror I think it's ok, but it also opens the door for potentially returning different images from what dagger's expecting (depending on the registry), leading to unexpected behavior and confusion. It has more implications and it's a use case for that better abstraction that we need, but I'm not so sure of doing the same thing as with auth for now.
shykes commentedon Jul 19, 2022
For the record, another short-term fix that might be better: move away from Docker Hub for default images in universe. Either by moving to a more generous image hosting provider that doesn't mind acting as a free CDN; or building images in such a way that a base image doesn't need to be downloaded again (build from distro packages a-la apko, or even from source). As discussed with @jpadams who will create an issue.
(We should still implement this stopgap. Just noting that we may be able to get rid of it later)
TomChv commentedon Oct 30, 2023
Our API has a method
WithAuthRegistryand we answered this question in our doc (https://docs.dagger.io/faq/#how-do-i-log-in-to-a-container-registry-using-a-dagger-sdk)