Skip to content

Dagger engine Go SDK does not account for private docker repositories 🐞  #3829

Closed

Description

@nipuna-perera

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

  1. aluzzardi commented on Nov 15, 2022

    @aluzzardi
    Contributor

    Thank you @nipuna-perera!

    /cc @sipsma if you happen to have an idea
    /cc @mircubed to flag this as important

  2. sipsma commented on Nov 16, 2022

    @sipsma
    Contributor

    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:

    1. Integrate this with buildkit's possible future support for source configuration, which includes not only pinning but also re-mapping of sources
    2. Add our own support for specifying mirrors and/or rewrites of image refs, one possibility being something like:
    extend type Query {
      withMirrors("docker.io", ["fcr.fmr.com"]) Query!
    }

    Could also make this an arg to dagger.Connect with 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).


    2 is maybe simpler in the short term and not conditional on unmerged buildkit PRs. 1 would probalby be part of a larger project around source pinning+remapping. If we are desperate to add support for this quickly, 2 may be the way to go.

    There could easily be simpler possibilities here I'm not considering too.

  3. nipuna-perera commented on Nov 20, 2022

    @nipuna-perera
    ContributorAuthor

    #3913 fixes this right @aluzzardi, @sipsma ?

  4. TomChv commented on Mar 24, 2025

    @TomChv
    Member

    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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions