Skip to content

Instantly share code, notes, and snippets.

@dejanu
Last active June 2, 2025 19:48
Show Gist options
  • Save dejanu/7b3e872a042e44678587c1d84983bb06 to your computer and use it in GitHub Desktop.
Save dejanu/7b3e872a042e44678587c1d84983bb06 to your computer and use it in GitHub Desktop.
builder

Buildkit

BuildKit is the image building engine inside Docker. It's not part of other container runtimes - like containerd - but you can run a BuildKit server in a container. docker build uses Buildx and BuildKit by default since Docker Engine 23.0.

You can install BuildKit by either running it natively via systemd or in a container.

BuildKit can also be built in a version that tightly integrates with containerd, using an existing containerd daemon for the storage and sharing it with other containerd clients.

Docker

Docker Engine automatically creates a builder that becomes the default backend for your builds. This builder uses the BuildKit library bundled with the daemon.

Docker build implements a client-server architecture, where:

  • Buildx is the client for running and managing builds, actually docker build invokes Buildx under the hood aka docker buildx build
  • Buildkit is the server (build engine) or builder that handles the build execution, more exactly a builder is a BuildKit daemon that you can use to run your builds

When you invoke a build, the Buildx client sends a build request to the BuildKit backend. BuildKit resolves the build instructions and executes the build steps. The build output is either sent back to the client or uploaded to a registry, such as Docker Hub.

Buildx is a Docker CLI plugin that extends the docker build command with the full support of the features provided by Moby BuildKit builder toolkit.

Build drivers are configurations for how and where the BuildKit backend runs, the following drivers are available:

  • docker (BuildKit library bundled into the Docker daemon)
  • docker-container (creates a dedicated BuildKit container using Docker)
  • kubernetes (creates BuildKit pods in a Kubernetes cluster)
  • remote (connects directly to a manually managed BuildKit daemon)
docker buildx ls

# create builkit instances in buildkit ns, 
docker buildx create  --bootstrap --name=kube --driver=kubernetes  --driver-opt=namespace=buildkit,replicas=2

docker buildx use kube

docker build -t demo https://github.com/dejanu/sretoolkit.git#remotebuild:docker_stuff --no-cache --builder kube

Kubernetes driver

Let's you connect you local development or CI environments to builders in a K8S cluster to allow access to more powerful compute resources, optionally on multiple native architectures.

Links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment