← Back to context

Comment by esafak

5 months ago

When was this; dagger runs on top of buildkit?

Very recently. It may run on BuildKit but it doesn't expose it as a build runtime. IIRC Dagger implements its own way of building images that lacks BuildKit features and doesn't work with Dockerfiles.

  • Hello! I'm the co-founder of Dagger. It seems that there was a misunderstanding, sorry about that.

    Dagger certainly can build a container image natively, without requiring a Dockerfile. It also can build a docker image from a Dockerfile, thanks to a built-in compatibility bridge.

    Dagger doesn't expose a raw buildkit socket, but it exposes a cleaner API that has 99% feature parity. Hitting the remaining 1% is rare, but it does happen :) Is there a specific buildkit feature you were looking for? Perhaps we can add it.

    Here's an example from the CLI (keeping in mind that there are SDKs for Go, Python, Typescript, PHP and Java with 1-1 feature parity to the CLI):

    1. Natively (without Dockerfile):

      #!/usr/bin/env dagger
      
      container |
      from alpine |
      with-exec apk add golang |
      with-directory /src . |
      with-workdir /src |
      with-exec go build |
      publish myregistry.tld/myimage:mytag
    
    

    2. Build a local directory with Dockerfile:

      #!/usr/bin/env dagger
      
      host |
      directory . |
      docker-build |
      publish myregistry.tld/myimage:mytag
    
    

    3. Build straight from git remote, with Dockerfile:

      #!/usr/bin/env dagger
      
      git https://github.com/your/repo |
      branch main |
      tree |
      docker-build |
      publish myregistry.tld/myimage:mytag
    
    

    I hope this helps! Sorry again that you got the wrong impression.

    • Thanks for your reply. We use BuildKit's cache + SSH socket mounts in most of our Dockerfiles so this was a blocker I came up against immediately when trying Dagger. I'd rather not share my username here but there's a conversation on Discord last month you can dig up (search buildkit in:general) to see what was discussed and proposed solutions.

      RE the part about not supporting Dockerfiles - sorry, that was incorrect, I misremembered.

      1 reply →