Earthly "could not connect to buildkitd" in CI
Earthly runs all builds inside a buildkitd container it starts through Docker. If the CI job has no Docker daemon, or the container cannot get the privileges buildkitd needs, Earthly cannot connect and fails before building.
What this error means
earthly fails early with "Error: ... could not connect to buildkitd" or "failed to start buildkit: ... Cannot connect to the Docker daemon". Nothing has built yet.
Error: could not connect to buildkitd: buildkitd did not start within the timeout
failed to start buildkit daemon: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?Common causes
No Docker daemon in the CI job
Earthly launches buildkitd via Docker. A job without a Docker daemon (no DinD service and no host socket) has nothing to start it.
buildkitd cannot get the privileges it needs
BuildKit needs elevated privileges. An unprivileged container or a restricted runtime blocks the daemon from starting.
How to fix it
Provide Docker in the job
- Add a Docker daemon: use a runner with Docker, or a docker:dind service.
- Confirm
docker infosucceeds in a step before Earthly runs. - Let Earthly start buildkitd once Docker is reachable.
- run: docker info
- run: earthly +buildRun in a privileged DinD service
When using docker:dind, run it privileged so buildkitd can start.
services:
docker:
image: docker:dind
options: --privilegedHow to prevent it
- Use a runner image that includes a working Docker daemon.
- Verify
docker infobefore invoking Earthly. - Grant the privileges buildkitd requires when running in DinD.