Skip to content

One binary #7466

Closed
Closed

Description

@shykes

Problem

Today Dagger is split in two components - a CLI and an OCI image - which are built and packaged separately, but should not be.

These components are tightly coupled: they are only usable together; must be upgraded together; the communication protocol between them is private and undocumented; and the functional boundary between them is not settled. The only reason for packaging them separately is that it's easier for us. But the price we (and our users) pay elsewhere may not be worth it.

The problems we encounter today include:

  1. Confusing architecture. Is this a traditional client/server architecture? If so, why is the protocol private? Why is the well-documented and stable GraphQL API not also used as a client/server protocol? And why does the CLI try to execute docker, when you say there is no dependency on docker? etc.
  2. Auto-download. The CLI needs to download its companion OCI image from a public registry, at run time. That is a non-starter for many security-conscious environments. It also makes it harder to use Dagger on a plane!
  3. Operational complexity. More moving parts to worry about; more words to understand; more complicated diagrams. Having two things is just more complicated than having one.
  4. Unclear relationship to container runtimes. This one is tricky. At the end of the day, Dagger is a container runtime. It runs containers itself, and requires the system privileges to do so, just like containerd, docker, podman, or the kubernetes kubelet. The fact that it is distributed in part as an OCI image, obscures that fact. It certainly is useful that you can run dagger inside a privileged pod or docker container, essentially using other container runtimes as a bootstrap. And it's certainly convenient that by packaging the "meaty" parts of Dagger exclusively in an OCI image, we have kept it under the radar of downstream repackagers, who are happy to naively go build the CLI and call it a day. But as a result, we are sweeping under the rug a crucial detail: dagger's job is to run containers, and it needs the privileges to do so. For many infrastructure teams, "OCI image" means "must be unprivileged". But here we are demanding to be run in a privileged container. This leads to the possible compromise of rootless. But rootless is a mirage: it will never be reliable enough and ubiquitous enough to be available to all OCI systems everywhere. If we were more upfront about Dagger's function as a container runtime, and packaged it as a single binary intended to run on the host machine, these misunderstandings would be resolved.
  5. Downstream timebombs. In spite of our trademark policy which forbids distributing a rebuild of our software and calling it Dagger, downstream packagers are doing so anyway - not out of ill will, but simply out of habit. Because the CLI is packaged separately, and we have punted on the difficult work of packaging the runtime components along with it, these downstream packagers are under the impression that they are redistributing a complete build of Dagger - when in fact they are only distributing half. If we bite the bullet and bundle it all together, their naive builds will be obviously broken. From our experience enforcing the policy with Nix, we know that simply explaining the inevitable moment when their build breaks in the future, hurting our users, is not enough - downstream packaging communities simply cannot believe that there is a build too custom and complicated for them. The only way for them to believe it, is to see it. This would make trademark enforcement less painful, by making it more obvious that we are not making an arbitrary irrational decision, but simply looking out for our users by keeping the complexity of the build in one place where we can manage it, and ensure the result is correct.

Solution

I propose that we bite the bullet, and package CLI and container runtime in one binary.

This presents several difficulties.

Per @sipsma:

I'd love that, and have done something similar in the past w/ bincastle, but getting everything smushed into there will be a challenge. Containerd+runc would be easy. CNI binaries are doable provided the are written in go. dnsmasq is just some c program though. The qemu emulators I have no idea 😄 etc.

There's ways of dealing with all of that of course, but that would be the main source of difficulty in trying to get a standalone binary. There's other stuff around platform specific issues too, though relatively straightforward.

Let's discuss these difficulties in the comments below.

FYI @jedevc @gerhard @matiasinsaurralde

Alternative solutions

One alternative which has been discussed, is to bundle the OCI image in the installer, instead of in the CLI. The CLI would still have to load it dynamically for bootstrap, but it would do so from the local filesystem, rather than from a remote registry.

Per @shykes :

the alternative is an installer which drops the oci image in your home directory
and the CLI fails (or at least big warning) without it

@sipsma:

Yes, that may be the only practical sort of option for some of them. Either drop the OCI image in the home dir or the CLI binary has everything embedded and unpacks them to the home dir (same end effect either way)

@jedevc:

We don't necessarily need it in the home dir, it could also potentially be in like /usr/share
I like the idea though

Activity

  1. shykes commented on May 27, 2024

    @shykes
    ContributorAuthor

    At the moment I prefer bundling everything into the CLI. It seems that it's more work than bundling in the installer, and may not make much difference initially. But bundling into the CLI feels like the right answer, because:

    1. it clarifies that Dagger is a complete container runtime, which removes friction and misunderstandings, especially for infrastructure operators;

    2. it gives us complete freedom of architecture and implementation. What is executed natively on the host or in an OCI image; what runs client-side or server-side; whether there even is a client or server; is completely up to us to decide, and can be changed later. Given the many design constraints we are dealing with, this freedom would make our life much easier!

  2. jedevc commented on May 27, 2024

    @jedevc
    Contributor

    I think building everything into the CLI makes sense, but there's still one point I'm confused on: with engine drivers, how do we deal with a remote dagger instance that runs a different platform from the client?

    e.g. I'm on a linux/amd64 machine, and connect to a remote linux/arm64 instance. I can't use the image bundled into my client (since it's the wrong platform). Even if it did match, it's unlikely we'd actually want to use it, since then it would have to be uploaded (when it would be much faster to download from a mirror registry, etc).

    Would we want to fallback to registry.dagger.io (or an explicitly configured proxy registry)? Is it confusing that we have two different behaviors for this? I think the fallback makes sense, but it means we have to deal with this incompatibility.

    The other option would be to bundle all the platforms into the cli together (which is wasteful). Or we can take a middle path where we bundle the manifest list + manifests of all the platforms, but only the layers for the local platform (then this still gets the version pinning we want).

  3. beingminimal commented on Nov 26, 2024

    @beingminimal

    @shykes @jedevc Any consideration for this feature?

  4. locked and limited conversation to collaborators on Mar 24, 2026
  5. converted this issue into a discussion #12238 on Mar 24, 2026
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