Skip to content

Build Backends

The build backend is a software or service responsible for actually building the images. dib itself is not capable of building images, it delegates this part to the build backend.

dib supports multiple build backends. Currently, available backends are docker, kaniko, and buildkit. You can select the backend to use with the --backend option. Note that docker and kaniko backends are deprecated and will be removed in a future release. buildkit is now the recommended and default backend.

Executor compatibility matrix

Backend Local Docker Kubernetes
Docker
Kaniko
BuildKit

Docker

Deprecated: The Docker backend is deprecated and will be removed in a future release. Please use the BuildKit backend instead.

The docker backend uses Docker behind the scenes, and runs docker build You need to have the Docker CLI installed locally to use this backend.

Authentication

The Docker Daemon requires authentication to pull and push images from private registries. Run the docker login command to authenticate.

Authentication settings are stored in a config.json file located by default in $HOME/.docker/. If you need to provide a different configuration, you can set the DOCKER_CONFIG variable to the path to another directory, which should contain a config.json file.

Remote Daemon

If you want to set a custom docker daemon host, you can set the DOCKER_HOST environment variable. The builds will then run on the remote host instead of using the local Docker daemon.

BuildKit

If available, dib will try to use the BuildKit engine to build images, which is faster than the default Docker build engine.

Kaniko

Deprecated: The Kaniko backend is deprecated and will be removed in a future release. Please use the BuildKit backend instead.

Kaniko offers a way to build container images inside a container or Kubernetes cluster, without the security tradeoff of running a docker daemon container with host privileges.

BuildKit

As Kaniko must run in a container, it requires Docker when running local builds as it uses the docker executor.

See the kaniko section in the configuration reference.

BuildKit

BuildKit is a toolkit for converting source code to build artifacts in an efficient, expressive and repeatable manner. It provides a more efficient, cache-aware, and concurrent build engine compared to the traditional Docker build.

Authentication

BuildKit uses the same authentication mechanism as Docker. Run the docker login command to authenticate with your registry.

Local Builds

For local builds, BuildKit requires the buildctl binary to be installed on your system and buildkitd daemon to be running. You can install BuildKit by following the instructions in the official documentation.

Kubernetes Builds

For Kubernetes builds, dib will create a pod with the BuildKit image and execute the build inside it. This requires proper configuration of Kubernetes access and Docker registry credentials.

BuildKit Host

You can specify a custom BuildKit daemon host using the --buildkit-host option or by setting the BUILDKIT_HOST environment variable.

See the buildkit section in the configuration reference.