I thought I already had everything sorted out but suddenly my pipelines in Kubernetes via Argo start failing. In my registry logs I see that dagger is trying to authenticate without user and then the request is rejected.
We do (shortend):
secrets = [
dag.set_secret("registry-password", await registry_password.plaintext()),
dag.set_secret("registry-username", registry_username),
]
container = (
directory.docker_build(
target=build_stage,
dockerfile=root_dir.file("scripts/dagger/docker/Dockerfile"),
build_args=build_args,
secrets=secrets or [],
)
.with_registry_auth(
"docker.artifacts.company.local", registry_username, registry_password
)
)
But apparently this does not provide authentication to any docker image pull inside the Dockerfile.
There was a similar question in the past: https://discord.com/channels/707636530424053791/1313155675572011049
But the solution isn't applicable for my situation.
The documentation states:
Use the Container.withRegistryAuth() GraphQL API method. A native equivalent of this method is available in each Dagger SDK.
Dagger SDKs can use your existing Docker credentials without requiring separate authentication. Simply execute docker login against your container registry on the host where your Dagger workflows are running.
https://docs.dagger.io/faq/#how-do-i-log-in-to-a-container-registry-using-a-dagger-sdk
But executing docker login that way isn't possible. It would be great if the docs could be extended for how to handle this in the Kubernetes case.
How can I do docker_build with docker registry authentication via the dagger python SDK?