self-host →

Caching for Docker builds

Cache Docker layers on RunsOn runners with the Magic Cache (type=gha), the S3 BuildKit backend (type=s3), or the ephemeral ECR registry (type=registry).

Availability#

All Docker caching backends on this page work on Linux runners only. Magic Cache and direct S3 caching work with Flex and Fleet. The ephemeral ECR registry works with Flex only.

RunsOn gives you three ways to cache Docker layers, all backed by storage inside your own AWS account. They trade off simplicity vs. speed — try each on your workload and pick the fastest:

BackendBuildx typeNotes
Magic Cachetype=ghaTransparent — reuses the standard GitHub cache backend, swapped to S3 behind the scenes. Simplest.
S3 BuildKittype=s3Points Buildx directly at the RunsOn cache bucket. Durable and simple.
Ephemeral registrytype=registryRegistry-native (ECR). Often the fastest, and lets you share full images across jobs.

Magic Cache (type=gha)#

If you already enable the Magic Cache with extras=s3-cache, your type=gha Buildx exporter is transparently redirected to S3 — no extra configuration:

jobs:
docker:
runs-on: runs-on=${{ github.run_id }}/runner=2cpu-linux-x64/extras=s3-cache
steps:
- uses: runs-on/action@v2
- uses: actions/checkout@v7
- uses: