---
title: "Setting Up and Managing Custom Buildx Builders"
date: "2026-11-18T15:30:00+07:00"
description: "Configuring custom Buildx builder instances, managing docker-container drivers, allocating resource limits, and linking remote builder nodes over SSH."
author: "AI Assistant"
image: "https://blog.redlinesoft.net/images/post/setting-up-managing-custom-buildx-builders.jpg"
alt: "Terminal window demonstrating docker buildx create, inspect, and use builder management commands"
tags: ['docker', 'buildx', 'devops', 'cli']
---

Docker Buildx manages build operations using **Builder Instances**. By default, Docker uses the `default` builder instance tied directly to the local host daemon. However, advanced features—such as multi-platform builds, distributed remote building, build cache export, and custom BuildKit configuration—require setting up **custom Buildx builders**.

In this tutorial, we will explore Buildx builder driver options, learn how to create and manage custom builders, configure BuildKit settings, and pool remote SSH builder nodes together.

## Buildx Driver Types Compared

Buildx supports several driver backends to execute build graphs:

```text
+-----------------------------------------------------------------------------------+
| 1. `docker` Driver (Default)                                                     |
|    - Uses the local Docker daemon's internal BuildKit component.                  |
|    - Limited: Cannot build multi-platform images directly to local store.         |
+-----------------------------------------------------------------------------------+
| 2. `docker-container` Driver (Recommended for Advanced Buildx)                     |
|    - Launches a dedicated BuildKit container instance (`moby/buildkit`).          |
|    - Full support for multi-arch, BuildKit cache mounts, and custom config.       |
+-----------------------------------------------------------------------------------+
| 3. `kubernetes` Driver                                                            |
|    - Provisions BuildKit pods inside a Kubernetes cluster.                       |
|    - Scales dynamically across cluster nodes for high-concurrency CI builds.      |
+-----------------------------------------------------------------------------------+
| 4. `remote` Driver                                                                |
|    - Connects directly to an externally managed BuildKit daemon (via gRPC).       |
+-----------------------------------------------------------------------------------+
```

## Step 1: Creating a Custom Builder

To create a new custom builder using the `docker-container` driver:

```bash
docker buildx create --name ci-builder \
  --driver docker-container \
  --driver-opt image=moby/buildkit:v0.12.0 \
  --use
```

- `--name ci-builder`: Names the builder instance.
- `--driver docker-container`: Uses an isolated containerized BuildKit daemon.
- `--use`: Sets this new builder as the active builder for subsequent `docker build` commands.

### Bootstrapping the Builder

Initialize and inspect the builder container:

```bash
docker buildx inspect --bootstrap
```

Sample output:
```text
Name:      ci-builder
Driver:    docker-container

Nodes:
Name:      ci-builder0
Endpoint:  unix:///var/run/docker.sock
Status:    running
BuildKit:  v0.12.0
Platforms: linux/amd64, linux/arm64, linux/riscv64, linux/s390x
```

## Step 2: Customizing BuildKit Configuration (`buildkitd.toml`)

You can supply custom BuildKit configuration files to adjust concurrency, mirror registries, or network settings.

Create a custom configuration file `buildkitd.toml`:

```toml
# buildkitd.toml
[worker.oci]
  max-parallelism = 8 # Limit concurrent layer build jobs

# Configure a pull-through mirror for Docker Hub
[registry."docker.io"]
  mirrors = ["http://registry-mirror.internal:5000"]

# Allow insecure HTTP registries for internal testing
[registry."registry.internal:5000"]
  http = true
  insecure = true
```

Create a new builder using this configuration:

```bash
docker buildx create --name production-builder \
  --driver docker-container \
  --config ./buildkitd.toml \
  --use
```

## Step 3: Pooling Remote Build Nodes Over SSH

To accelerate multi-architecture builds, you can connect multiple physical machines (e.g. an Intel build server + an ARM Graviton server) into a single distributed Buildx builder pool.

```text
+-----------------------------------------------------------------------------------+
| Combined Builder Pool: `hybrid-pool`                                             |
+-----------------------------------------------------------------------------------+
  ├── Node 1: Local Host (Intel `amd64`)  --> Builds `linux/amd64` layers
  └── Node 2: Remote Host over SSH (`arm64`) --> Builds `linux/arm64` layers
```

### Commands:

```bash
# 1. Create builder with local node
docker buildx create --name hybrid-pool --node intel-node --use

# 2. Append remote ARM node via SSH context
docker context create arm-server --docker "host=ssh://user@arm-build-node.internal"
docker buildx create --name hybrid-pool --append --node arm-node arm-server

# 3. Inspect the pooled builder nodes
docker buildx inspect --bootstrap
```

Now when you run `docker buildx build --platform linux/amd64,linux/arm64 --push .`, BuildKit automatically routes `amd64` compilation to the Intel machine and `arm64` compilation to the remote ARM machine natively without QEMU emulation!

## Step 4: Managing and Switching Builders

```bash
# List all configured builders
docker buildx ls

# Switch active builder
docker buildx use ci-builder

# Stop a builder container instance
docker buildx stop ci-builder

# Remove a builder instance
docker buildx rm ci-builder
```

## Summary Checklist

| Task | Command |
| :--- | :--- |
| **Create Container Builder** | `docker buildx create --name mybuilder --driver docker-container --use` |
| **Bootstrap Builder** | `docker buildx inspect --bootstrap` |
| **Pass Custom Config** | `docker buildx create --config ./buildkitd.toml ...` |
| **Pool Remote SSH Node** | `docker buildx create --name pool --append arm-context` |

Custom Buildx builder instances give platform teams fine-grained control over build concurrency, caching, and distributed multi-architecture compilation.
