ScriptsMar 31, 2026·2 min read

Dagger — Programmable CI/CD Engine

Run CI/CD pipelines as code — locally, in CI, or in the cloud. Replace YAML with real programming languages. Cacheable, portable, testable. 15.6K+ stars.

TL;DR
Dagger lets you write CI/CD pipelines as code in Python, Go, or TypeScript instead of YAML, with local execution and caching.
§01

What it is

Dagger is a programmable CI/CD engine that replaces YAML-based pipeline configurations with real programming languages. You write pipelines in Python, Go, TypeScript, or any language with an SDK, and run them locally on your laptop, in any CI system, or in the cloud. Every step runs in a container with automatic caching.

DevOps engineers and platform teams frustrated with debugging YAML indentation and vendor-specific CI syntax use Dagger to bring software engineering practices (testing, modularity, type safety) to their build pipelines.

§02

How it saves time or tokens

YAML-based CI systems (GitHub Actions, GitLab CI, Jenkins) are hard to test locally and impossible to debug without pushing to the CI server. Dagger pipelines run identically on your laptop and in CI, eliminating the push-and-pray debugging cycle. The built-in content-addressed cache means unchanged steps are skipped on subsequent runs.

Dagger functions are composable and shareable. Instead of copying YAML snippets between repositories, you publish reusable functions that other teams import with type-checked interfaces.

§03

How to use

  1. Install the Dagger CLI:
curl -fsSL https://dl.dagger.io/dagger/install.sh | sh
  1. Run a function from a module:
dagger -m github.com/dagger/dagger/dev/go call build --source=.
  1. Or use the Python SDK:
import dagger
import anyio

async def main():
    async with dagger.Connection() as client:
        out = await (
            client.container()
            .from_('python:3.12')
            .with_exec(['python', '-c', 'print("hello")'])
            .stdout()
        )
        print(out)

anyio.run(main)
§04

Example

A Dagger pipeline that builds and tests a Go project:

import dagger
import anyio

async def ci():
    async with dagger.Connection() as client:
        src = client.host().directory('.')
        golang = (
            client.container()
            .from_('golang:1.22')
            .with_directory('/app', src)
            .with_workdir('/app')
        )
        await golang.with_exec(['go', 'test', './...']).stdout()
        await golang.with_exec(['go', 'build', '-o', 'app']).stdout()

anyio.run(ci)
§05

Related on TokRepo

§06

Common pitfalls

  • Dagger requires a running Docker daemon. Rootless Docker works but needs explicit configuration for the Dagger engine socket.
  • First-run cold cache is slow because every container layer must be pulled. Subsequent runs with the same dependencies are fast due to content-addressed caching.
  • SDK version mismatches between the CLI and language SDK cause cryptic errors. Pin both to the same version in your project.

Frequently Asked Questions

Which programming languages does Dagger support?+

Dagger has official SDKs for Python, Go, and TypeScript. The engine exposes a GraphQL API, so any language that can make GraphQL calls can theoretically drive Dagger pipelines. Community SDKs exist for other languages.

Can I use Dagger with my existing CI system?+

Yes. Dagger runs inside any CI system (GitHub Actions, GitLab CI, Jenkins, CircleCI) as a single CLI call. Your CI config becomes a thin wrapper that invokes `dagger call`, and the actual pipeline logic lives in your codebase as testable code.

How does Dagger caching work?+

Dagger uses content-addressed caching at the operation level. Each container step is cached by its inputs (base image, files, commands). If the inputs have not changed, the cached result is reused. This works identically locally and in CI.

What is a Dagger Module?+

A Dagger Module is a reusable package of functions that others can call. You publish modules to any Git repository and consumers import them by URL. Modules have typed interfaces, so callers get documentation and validation automatically.

Does Dagger replace Docker?+

No. Dagger uses Docker (or compatible container runtimes) under the hood. It replaces YAML-based CI configurations, not the container runtime itself. You still write Dockerfiles for your application images; Dagger orchestrates the build pipeline.

Citations (3)
🙏

Source & Thanks

Created by Dagger. Licensed under Apache 2.0. dagger/dagger — 15,600+ GitHub stars

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets