Skip to content
Latchkey

dockerd and DOCKER_BUILDKIT Reference

The Docker daemon and the BuildKit toggle.

dockerd is the Docker daemon that the CLI talks to. DOCKER_BUILDKIT=1 forces the classic docker build to use the BuildKit engine on setups where it is not already the default, unlocking better caching, parallelism, and Dockerfile features.

Key knobs

  • DOCKER_BUILDKIT=1 - use BuildKit for docker build (default in modern Docker)
  • DOCKER_BUILDKIT=0 - fall back to the legacy builder
  • DOCKER_HOST - daemon endpoint the CLI connects to
  • dockerd - start the daemon (rarely run by hand in CI)
  • COMPOSE_DOCKER_CLI_BUILD=1 - make compose build use the CLI/BuildKit

Example

shell
export DOCKER_BUILDKIT=1
docker build -t app:ci .

# Legacy builder fallback if a Dockerfile feature breaks:
DOCKER_BUILDKIT=0 docker build -t app:legacy .

In CI

Most runners ship BuildKit on by default, but set DOCKER_BUILDKIT=1 explicitly to guarantee features like --mount=type=cache and heredoc Dockerfiles work. You rarely start dockerd yourself; the runner provides it. On Latchkey managed runners BuildKit is available out of the box.

Key takeaways

  • DOCKER_BUILDKIT=1 forces the modern BuildKit engine for docker build.
  • Set =0 to fall back to the legacy builder when a BuildKit feature misbehaves.
  • DOCKER_HOST points the CLI at a specific daemon; dockerd is rarely launched by hand in CI.

Related guides

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