WarpBuild LogoWarpBuild Docs

Docker Layer Caching

2-5x faster builds with fast docker container layer cache for Github Actions runners

It is recommended to use the new Docker Builders for a faster and better build experience.

Since WarpBuild Cache seamlessly integrates as a drop-in replacement for GitHub Actions Cache, you can easily use it for Docker Layer Caching.

Step 1: Set Up Docker Buildx Action

Ensure that the Docker Buildx Action is included in your workflow file if it isn't already. This step is essential to enable the GHA backend for Docker Layer Caching.

Note: Don't forget to include the driver-opts key as shown below.

- name: Set up Docker Buildx
  uses: docker/setup-buildx-action@v3
  with:
    driver-opts: |
      network=host

Step 2: Configure Docker Build Push Action

Update the cache-from and cache-to fields by setting the url to http://127.0.0.1:49160/, as shown below. Ensure that the type is set to gha. WarpBuild Cache will automatically proxy the storage backend for docker layer caching.

Note: It is recommended to set mode=max. This setting ensures that all layers, including intermediate steps, are cached. For more details, read about the mode here.

- name: Docker WarpCache Backend
  uses: docker/build-push-action@v6
  with:
    context: .
    push: false
    tags: "alpine/warpcache:latest"
    cache-from: type=gha,url=http://127.0.0.1:49160/
    cache-to: type=gha,url=http://127.0.0.1:49160/,mode=max

That's all there is to it! With these adjustments, WarpBuild Cache is now set up as your Docker Layer Caching backend.

Troubleshooting

Failed to commit cache

This error occurs usually when the docker layers are large and the runner size is small. For example, if you are using the 2x runner and some of the docker layers are larger than 5GB, you will likely encounter this error.

To resolve this issue, please upgrade to a larger runner size.

Last updated on

On this page