Skip to main content
Reuse completed build steps so your Docker images are ready sooner. Celesto saves those results for your next job. Docker builds images in steps called layers. Reusing saved layers lets later builds skip steps that haven’t changed. Each job gets a fresh computer, so local Docker images and layers disappear when the job ends. To reuse layers in a later job, save them to the Celesto cache with cache-to: type=gha and restore them with cache-from: type=gha. No special runner label or setting is needed.

Configure your workflow

First connect your repository to Celesto. For a repository with a Dockerfile at its root, save this workflow as .github/workflows/docker-cache.yml:
.github/workflows/docker-cache.yml
  • mode=max saves the layers from every build stage, not only the final image.
  • scope names the cache. Give each image its own scope so builds don’t overwrite each other’s layers.
If your workflow already uses cache-from and cache-to with type=gha, you only need to switch runs-on to a Celesto runner. This works when the workflow uses the cache address the runner provides. Workflows that set their own cache address are an exception. The first Celesto run misses because GitHub keeps its caches in a separate store. Saved layers count toward the same storage limits as your other caches and follow the same access rules and 7-day expiry. Large layer caches can cause older dependency caches to be removed sooner. A restore can still miss, so compare complete build time with and without the cache. The public cache acceptance suite includes Docker workflows you can run to check caching in your own repository. It checks that caching works, not how much time it saves.

Verify reuse

Run the workflow successfully, then rerun it with the same Dockerfile and build inputs. Check the build logs for steps marked CACHED, and compare the complete job duration. The first run saves layers for later builds. For image builds and database services, see Docker builds and services.
Last modified on November 5, 2026