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
📖 Implement BUILDKIT_CA_CERTS env variable to mount CA certificates inside spawned dagger-buildkitd container #2016
I'm trying to push an image to our private registry, but docker.#Push is failing with x509: certificate signed by unknown authority.
I'm running dagger locally on macOS and can confirm that the our private CA cert is indeed present in the system keychain as described here. I am able to manually run docker push my.private.registry/proj/example without issue.
Log output
[✗] actions.push 0.2s6:15AM FTL failed to execute plan: task failed: actions.push._push: failed to do request: Head "https://<... redacted ...>/blobs/sha256:36d215df336793e88ec6c4e3b7ac55c1b553b65541854a0ce1b2171970ae9ede": x509: certificate signed by unknown authority
Steps to reproduce
Use docker.#Push & { dest: "my.private.registry/proj/example" } in a dagger action, where the my.private.registry server certificate is signed by a private trusted CA.
you're not trying to expand an environment variable inside dest?
No, not trying to expand any environment variables inside dest or anywhere else. In my actual dagger file, I'm using the real resolvable DNS name for our private registry.
EDIT: I've updated the issue description above to remove any ambiguity.
Ok, I've used it successfully with the registry:2 docker image, behind Nginx and Let's Encrypt (in docker Swarm).
Can you give any more details about your setup to enable us to reproduce your issue? I guess the error x509: certificate signed by unknown authority means you're self-signing or using a CA we don't have included.
you'll need to have a custom Buildlkit setup if the certificate needs to be inside the buildkit container
After some more review, I'm pretty confident this is what will be needed, since from what I understand, docker.#Pull is executed in the buildkit container.
I'll work on creating and using a custom buildkit (thanks for this link @grouville !) and report back here.
@grouville I can confirm that running the above, mounting our private CA cert into the buildkit container, DOES in fact fix the issue --- I was able to use docker.#Push successfully in my dagger pipeline. Thank you!
My 2 cents: this seems like a common enough scenario that a standard, built-in way to do this would take this from "fiddly & manual" UX to "awesome" UX :)
@grouville I can confirm that running the above, mounting our private CA cert into the buildkit container, DOES in fact fix the issue --- I was able to use docker.#Push successfully in my dagger pipeline. Thank you!
My 2 cents: this seems like a common enough scenario that a standard, built-in way to do this would take this from "fiddly & manual" UX to "awesome" UX :)
I work in an organization which using an image registry which, in addition to presenting a server cert issued by a non-public CA, also requires a client certificate issued by the same CA for access, so ideally the mechanism used to identify the location of the issuing CA could include additional fields for a cert and key if client cert auth is required.
I don't think it should be in the plan. Using environment variables would be better. Like when you connect to a remote docker daemon you have DOCKER_TLS_VERIFY and DOCKER_CERT_PATH.
changed the title [-]🐞 Can't `docker.#Push` to private registry (`x509: certificate signed by unknown authority`)[/-][+]📖 Implement `BUILDKIT_CA_CERTS` env variable to mount CA certificates inside `dagger-buildkitd`[/+]on Apr 8, 2022
changed the title [-]📖 Implement `BUILDKIT_CA_CERTS` env variable to mount CA certificates inside `dagger-buildkitd`[/-][+]📖 Implement `BUILDKIT_CA_CERTS` env variable to mount CA certificates inside spawned `dagger-buildkitd` container[/+]on Apr 8, 2022
I'm closing this since @qjcg fixed their problem with a workaround.
Note that the core issue (ability to configure trusted CAs to support private docker registries) is not yet fixed: workarounds are still needed, not just for CUE developers but now Go, Python, NodeJS and GraphQL developers as well. Solving that issue is finally moving to the top of our list, and is tracked here: #4217
Activity
helderco commentedon Apr 4, 2022
Are you actually using
$private-registryin there, or is it just a placeholder for the example?qjcg commentedon Apr 4, 2022
Just a placeholder for the example :)
helderco commentedon Apr 4, 2022
Ok, but just to be clear... you're not trying to expand an environment variable inside
dest?qjcg commentedon Apr 4, 2022
No, not trying to expand any environment variables inside dest or anywhere else. In my actual dagger file, I'm using the real resolvable DNS name for our private registry.
EDIT: I've updated the issue description above to remove any ambiguity.
helderco commentedon Apr 4, 2022
Ok, I've used it successfully with the
registry:2docker image, behind Nginx and Let's Encrypt (in docker Swarm).Can you give any more details about your setup to enable us to reproduce your issue? I guess the error
x509: certificate signed by unknown authoritymeans you're self-signing or using a CA we don't have included.grouville commentedon Apr 4, 2022
@helderco related I think: moby/buildkit#1050. Especially this one: moby/buildkit#1050 (comment)
grouville commentedon Apr 4, 2022
@qjcg I think there are two possibilities: you try to mount this certificate inside the container and check if it works (would be so cool🤞), or you'll need to have a custom Buidlkit setup if the certificate needs to be inside the buildkit container. An example is present here, and we can of course totally help: https://github.com/tonistiigi/buildkit/blob/56f76a56211bee437c0ef78e8fd9314bf9da9639/docs/buildkitd.toml.md
How to connect to this different Buildkit container with Dagger:
https://github.com/dagger/dagger/blob/3ddf6c995c09d172ba1280939f2c16ea48316b9a/docs/administrator/1013-operator-manual.md
qjcg commentedon Apr 4, 2022
Yes, I confirm that this is the case.
After some more review, I'm pretty confident this is what will be needed, since from what I understand,
docker.#Pullis executed in the buildkit container.I'll work on creating and using a custom buildkit (thanks for this link @grouville !) and report back here.
grouville commentedon Apr 4, 2022
You may try this:
qjcg commentedon Apr 4, 2022
@grouville I can confirm that running the above, mounting our private CA cert into the buildkit container, DOES in fact fix the issue --- I was able to use
docker.#Pushsuccessfully in my dagger pipeline. Thank you!My 2 cents: this seems like a common enough scenario that a standard, built-in way to do this would take this from "fiddly & manual" UX to "awesome" UX :)
Maybe something like:
grouville commentedon Apr 4, 2022
Excellent idea 😇
cc @helderco wdyt ?
GooseYArd commentedon Apr 4, 2022
I work in an organization which using an image registry which, in addition to presenting a server cert issued by a non-public CA, also requires a client certificate issued by the same CA for access, so ideally the mechanism used to identify the location of the issuing CA could include additional fields for a cert and key if client cert auth is required.
helderco commentedon Apr 4, 2022
I don't think it should be in the plan. Using environment variables would be better. Like when you connect to a remote docker daemon you have
DOCKER_TLS_VERIFYandDOCKER_CERT_PATH.qjcg commentedon Apr 5, 2022
Env vars could definitely work, something like
BUILDKIT_CA_CERTS.grouville commentedon Apr 8, 2022
@qjcg, I added the workaround to the doc: https://docs.dagger.io/1224/self-signed-certificates/. Closing this issue because it's more of a design improvement
grouville commentedon Apr 8, 2022
Reopening after discussion with @helderco, just changing the name
[-]🐞 Can't `docker.#Push` to private registry (`x509: certificate signed by unknown authority`)[/-][+]📖 Implement `BUILDKIT_CA_CERTS` env variable to mount CA certificates inside `dagger-buildkitd`[/+][-]📖 Implement `BUILDKIT_CA_CERTS` env variable to mount CA certificates inside `dagger-buildkitd`[/-][+]📖 Implement `BUILDKIT_CA_CERTS` env variable to mount CA certificates inside spawned `dagger-buildkitd` container[/+]shykes commentedon Dec 21, 2022
I'm closing this since @qjcg fixed their problem with a workaround.
Note that the core issue (ability to configure trusted CAs to support private docker registries) is not yet fixed: workarounds are still needed, not just for CUE developers but now Go, Python, NodeJS and GraphQL developers as well. Solving that issue is finally moving to the top of our list, and is tracked here: #4217