Skip to content
Latchkey

Dagger vs Earthly: Portable CI Pipelines Compared

Both let you define containerized pipelines that run identically on a laptop and in any CI. Dagger expresses pipelines as code via SDKs; Earthly uses an Earthfile that blends Dockerfile and Makefile syntax.

Dagger and Earthly attack the same pain: CI pipelines that only run in CI and behave differently locally. Both build on BuildKit for caching and reproducibility, but they differ in how you author pipelines. Here is the comparison.

DaggerEarthly
Pipeline definitionCode via SDKs (Go, Python, TS) + Dagger FunctionsEarthfile (Dockerfile + Makefile style)
EngineBuildKit-basedBuildKit-based
PortabilitySame on laptop and any CISame on laptop and any CI
CachingAutomatic layer/op cachingAutomatic layer caching + cache mounts
Mental modelProgrammable DAG / functionsDeclarative targets
Best fitComplex logic, reuse across languagesStraightforward, readable build targets

Code vs declarative

Dagger models pipelines as programmable functions you write in a real language (Go, Python, TypeScript and more), which is powerful when pipeline logic is complex or shared. Earthly keeps things declarative: an Earthfile reads like a Dockerfile with build targets, which is quick to grasp and review. Pick based on whether you want programmability or readability.

Caching and reproducibility

Both run on BuildKit, so they cache build steps by content and skip unchanged work. Earthly exposes explicit cache mounts and target-level caching; Dagger caches operations in its engine automatically. In both, the headline benefit is that a green run locally means a green run in CI.

In CI

Because both wrap your steps in containers, they reduce works-on-my-machine failures and make CI logic testable outside the CI provider. Run the Dagger engine or Earthly with a persistent BuildKit cache so CI reuses layers across builds.

The verdict

Choose Dagger when you want pipelines as real code with cross-language reuse; choose Earthly when a readable, Dockerfile-like Earthfile covers your needs. Both deliver portable, cache-friendly builds that behave the same locally and in CI.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →