Blogs / Docker Builds on My CI Runners Stalled Because of a 50-Byte MTU Gap

Docker Builds on My CI Runners Stalled Because of a 50-Byte MTU Gap

December 3, 2026 • Matthew Duong • Kubernetes;Self Hosting;Devops • 5 min read

Docker Builds on My CI Runners Stalled Because of a 50-Byte MTU Gap

On 10 November two ds160 pull requests failed in the API image build. yarn install stopped on the canvas package:

prebuild-install warn install Request timed out

canvas tries to download a prebuilt binary, an 8.7 MB GitHub release asset. When that fails it falls back to compiling from source, and node-gyp then stopped with Could not find any Python installation because the slim image has no Python. Both PRs passed when I re-ran them.

The builds run on my self-hosted GitHub Actions runners: Actions Runner Controller in Kubernetes, with Docker-in-Docker (dind) for image builds. That same week the runners also took down my cluster twice, but this problem was unrelated.

I treated it as a flaky download first

A 60-second timeout on a GitHub download looked like GitHub being slow, so I made the build tolerate it. I kept prebuild-install’s download cache in a BuildKit cache mount and retried three times, 30 and then 60 seconds apart.

That didn’t help. Every job gets a fresh runner pod with a fresh dind daemon, so the cache mount always started empty. All three tries stalled for the full 60 seconds.

Next I tried fetching the binary once with ADD --checksum in its own build stage, so the registry cache would keep it. That fetch failed too, in a different way:

net/http: TLS handshake timeout

From a machine outside the cluster the same download took 0.5 seconds.

The dind bridge was 50 bytes bigger than the pod’s network

The runner pods are on Canal, which uses flannel VXLAN. VXLAN adds 50 bytes of headers to each packet, so pod interfaces get an MTU of 1450 (veth_mtu: "1450" in rke2-canal-config). The dind sidecar’s dockerd had no --mtu flag, so its bridge defaulted to 1500. A diagnostic step in the workflow printed both:

pod eth0 MTU 1450; dind bridge MTU 1500

docker/setup-buildx-action runs BuildKit in a container on that bridge. Its TCP connections advertise a maximum segment size that fits 1500 bytes, so the server sends full-size packets, and those packets don’t fit through the pod’s 1450. They only arrive if something on the path does path MTU discovery or clamps the segment size, and here nothing did.

Small requests and replies fit inside 1450 bytes, which is why most of the build worked. A TLS handshake fails because the server’s certificate comes back in full-size packets. The runner container shares the pod’s network namespace and sees 1450 directly, so checkout, the lockfile check and the tag pushes never had the problem.

The first fix was a Docker network in each workflow

The quickest fix was in ds160’s workflows: create a Docker network with the pod’s MTU and run BuildKit on it.

- name: Docker network with the pod's MTU
  run: |
      mtu=$(cat /sys/class/net/eth0/mtu)
      echo "pod eth0 MTU $mtu; dind bridge MTU $(docker network inspect bridge --format '{{index .Options "com.docker.network.driver.mtu"}}')"
      docker network create --opt com.docker.network.driver.mtu="$mtu" buildkit-pod-mtu

- name: Set up Docker Buildx
  uses: docker/setup-buildx-action@v4
  with:
      driver-opts: network=buildkit-pod-mtu

The step reads the MTU from the pod instead of hard-coding 1450, so it still works if the CNI changes. To prove it, I forced the install stage to rebuild with a temporary no-cache-filters. canvas downloaded on the first try and yarn install finished in 29 seconds. The next morning I added the same steps to the web-app and form-agent builds and forced rebuilds of those too. The form-agent’s apt installs from NodeSource and Google’s Chrome repository succeeded on the first try, and the web-app’s yarn install took 69 seconds.

The lasting fix was in the runner scale set

A per-workflow step only fixes the workflows that have it. Every repo on these runners had the same 1500-byte bridge, so the real fix was to start dockerd with the right MTU.

The gha-runner-scale-set chart (0.13.0) doesn’t allow that in dind mode. Its dind arguments are fixed, and a template container named dind gets dropped. So I turned off containerMode: dind and wrote the whole dind setup into the runner template myself: the init container that copies the runner’s externals, the dind sidecar with its startup probe, the runner’s DOCKER_HOST, and the three emptyDir volumes. Here is the part that matters:

- name: dind
  image: docker:dind
  command: ["/bin/sh", "-c"]
  args:
    - >-
      mtu=$$(cat /sys/class/net/eth0/mtu) &&
      exec dockerd-entrypoint.sh dockerd
      --host=unix:///var/run/docker.sock
      --group=$(DOCKER_GROUP_GID)
      --mtu="$mtu"
      --default-network-opt=bridge=com.docker.network.driver.mtu="$mtu"

--mtu sets the default bridge. --default-network-opt sets every network a job creates, such as a Compose network or one from docker network create. $$( is how you write a literal $( in a Kubernetes container spec. $(DOCKER_GROUP_GID) is expanded from the container’s env, as the chart did.

The cost is maintenance. Everything the chart used to render for dind is now my YAML, and I have to check it against the chart’s dind templates whenever I bump the chart. The per-workflow steps are still in ds160’s workflows. They’re redundant now, and taking them out is on my list.

If you run dind on an overlay network, compare docker network inspect bridge with the pod’s eth0 MTU before you go looking for flaky downloads.