BuildKit and Kubernetes

BuildKit and Kubernetes

BuildKit can be used as a build service in Kubernetes

Multiple examples available



BuildKit understands the schema kube-pod://


Multiple pods can run simultaneously

Build is passed to any one of them by the service

Demo: BuildKit and Kubernetes

Pass build to remote pod

Create cluster:

kind create cluster

Run BuildKit daemon:

kubectl apply -f pod.rootless.yaml

Run build:

export BUILDKIT_HOST=kube-pod://buildkitd
buildctl build \
    --frontend=dockerfile.v0 \
    --local context=. \
    --local dockerfile=.

Using BuildKit with GitLab CI

Described in my blog post

Published demo on

Option 1: BuildKit daemon as service

Service is running next to build job

Connection is configured through variable BUILDKIT_HOST

Option 2: BuildKit daemonless

Using the script

BuildKit daemon is started on-the-fly

Using BuildKit in GitHub Actions

Official actions provided by Docker

Based on buildx

Comprehensive example


Obtain metadata for tagging and labels

Install qemu static binaries for buildx

Setup buildx for multi-platform builds

Login to Docker Hub for pushing images

Build and push container image