Skip to content
Latchkey

Dagger "failed to connect to engine" in CI

The Dagger CLI provisions and connects to a Dagger Engine container, which needs a Docker daemon or a compatible runtime. If Docker is absent or the engine cannot start, the CLI cannot connect and the run aborts before any pipeline runs.

What this error means

dagger fails with "failed to connect to engine" or "Cannot connect to the Docker daemon" before your functions run.

dagger
Error: failed to connect to engine: failed to start engine: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Common causes

No Docker daemon in the job

Dagger runs its engine as a container. A CI job with no Docker daemon has no runtime to start the engine.

The engine container could not start

Missing privileges or a blocked image pull prevents the engine container from coming up, so the CLI has nothing to connect to.

How to fix it

Provide Docker for the engine

  1. Use a runner with Docker, or add a docker:dind service.
  2. Confirm docker info works before invoking dagger.
  3. Let the CLI provision the engine once Docker is reachable.
.github/workflows/ci.yml
- run: docker info
- run: dagger call build

Point at an existing engine

If you run the engine as a service, set the runner variable so the CLI connects to it instead of provisioning one.

Terminal
export _EXPERIMENTAL_DAGGER_RUNNER_HOST=docker-container://dagger-engine

How to prevent it

  • Run Dagger on a runner with a working Docker daemon.
  • Verify docker info before invoking dagger.
  • Reuse a provided engine service for faster startup.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →