Repository navigation
Description
What is the issue?
My company mandates that all docker images be proxied via Artifactory. Hence we can't pull docker.io/golang:alpine. We have to pull company.repo.com/golang:alpine after doing docker login company.repo.com. The private registry login does not translate into the buildkit image that dagger runs all its actions within.
Dagger engine downloads docker.io/library/golang:1.18.2-alpine which is blocked by the firewall. There is no way to customize this via Dagger Go SDK when initializing the client.
Technically this would affect both the initialization of the dagger client and pulling images using Container().From() api, however, I can workaround the Container().From() by using Go exec.Command("docker", "login"...) and then referring to the image as Container().From("mycompany.repo.com/golang:latest") for example.
However, I can't get around the Dagger engine docker.io/golang:alpine pull that happens behind the scenes without hosting my own buildkit image with a custom buildkit config like the following
debug = true
[registry."docker.io"]
mirrors = ["fcr.fmr.com"]This is not very scale-able or user friendly and it feels like a hack. It would be great if Dagger engine could provide an interface to set a registry mirror and log into private docker registries.
#3726 is related because when this is fixed, I'd need to have my corp proxies set/pass-through to the internal image for it to be able to download the necessary tools with apk add
Log output
Building with Dagger
#1 resolve image config for company.repo.com/golang:latest
#1 DONE 3.2s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 DONE 0.0s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 ERROR: failed to do request: Head "https://registry-1.docker.io/v2/library/golang/manifests/1.18.2-alpine": tls: first record does not look like a TLS handshake
------
> [internal] load metadata for docker.io/library/golang:1.18.2-alpine:
------
input:1: container.from.withMountedDirectory.withWorkdir.exec build shim: golang:1.18.2-alpine: failed to do request: Head "https://registry-1.docker.io/v2/library/golang/manifests/1.18.2-alpine": tls: first record does not look like a TLS handshake
Please visit https://dagger.io/help#go for troubleshooting guidance.Steps to reproduce
No response
Dagger version
0.4.0
OS version
macOS 12.4
Activity
aluzzardi commentedon Nov 15, 2022
Thank you @nipuna-perera!
/cc @sipsma if you happen to have an idea
/cc @mircubed to flag this as important
sipsma commentedon Nov 16, 2022
For the very specific problem w/ the shim, I think we should just move to including pre-built shims in our engine image, there's already existing motivation for doing so: #3733
In general for the problem of supporting mirrors and/or remapping of images, I can think of two high-level possibilities right now:
Could also make this an arg to
dagger.Connectwith the usual tradeoffs of then increasing the amount of work we need to do for each SDK (whereas putting it in the API lets us use codegen among other benefits).2is maybe simpler in the short term and not conditional on unmerged buildkit PRs.1would probalby be part of a larger project around source pinning+remapping. If we are desperate to add support for this quickly,2may be the way to go.There could easily be simpler possibilities here I'm not considering too.
nipuna-perera commentedon Nov 20, 2022
#3913 fixes this right @aluzzardi, @sipsma ?
TomChv commentedon Mar 24, 2025
I think this is resolved by https://docs.dagger.io/configuration/engine/#custom-registries so we can close this issue.
Feel free to reopen it if I'm wrong :)