LogoLogo
HomeBlogGitHubGet Started FreeLogin
Earthly 0.7
Earthly 0.7
  • 👋Introduction
  • 💻Install Earthly
  • 🎓Learn the basics
    • Part 1: A simple Earthfile
    • Part 2: Outputs
    • Part 3: Adding dependencies With Caching
    • Part 4: Args
    • Part 5: Importing
    • Part 6: Using Docker In Earthly
    • Part 7: Using remote runners
    • Part 8a: Using Earthly in your current CI
    • Final words
  • ⭐Featured guides
    • Rust
  • 📖Docs
    • Guides
      • Importing
      • Build arguments and secrets
      • Functions
      • Using Docker in Earthly
      • Multi-platform builds
      • Authenticating Git and image registries
      • Integration Testing
      • Debugging techniques
      • Podman
      • Configuring registries
        • AWS ECR
        • GCP Artifact Registry
        • Azure ACR
        • Self-signed certificates
      • Using the Earthly Docker Images
        • earthly/earthly
        • earthly/buildkitd
      • ✅Best practices
    • Caching
      • Caching in Earthfiles
      • Managing cache
      • Caching via remote runners
      • Caching via a registry (advanced)
    • Remote runners
    • Earthfile reference
      • Builtin args
      • Excluding patterns
      • Version-specific features
    • The earthly command
    • Earthly lib
    • Configuration reference
    • Examples
    • Misc
      • Alternative installation
      • Data collection
      • Definitions
      • Public key authentication
  • 🔧CI Integration
    • Overview
    • Use the Earthly CI Image
    • Build your own Earthly CI Image
    • Pull-Through Cache
    • Remote BuildKit
    • Vendor-Specific Guides
      • Jenkins
      • Circle CI
      • GitHub Actions
      • AWS CodeBuild
      • Kubernetes
      • Google Cloud Build
      • GitLab CI/CD
      • Woodpecker CI
      • Bitbucket Pipelines
  • ☁️ Earthly Cloud
    • Overview
    • Managing permissions
    • Cloud secrets
    • Earthly Satellites
      • Managing Satellites
      • Using Satellites
Powered by GitBook
On this page
  • Local cache
  • Local cache location
  • Specifying the local cache size limit
  • Resetting the local cache
  • Cache on a remote runner / Earthly Satellite
  • Configuring the cache size on a remote runner
  • Resetting the cache on a remote runner
  • Auto-skip cache

Was this helpful?

Edit on GitHub
  1. Docs
  2. Caching

Managing cache

PreviousCaching in EarthfilesNextCaching via remote runners

Last updated 1 year ago

Was this helpful?

This page describes how to manage the Earthly cache locally or on a remote runner, such as an Earthly Satellite.

Local cache

Local cache location

Earthly cache is persisted in a docker (or podman) volume called earthly-cache on your system. When Earthly starts for the first time, it brings up a BuildKit daemon in a Docker container, which initializes the earthly-cache volume. The volume is managed by Earthly's BuildKit daemon and there is a regular garbage-collection for old cache.

Specifying the local cache size limit

The default cache size is adaptable depending on available space on your system. It defaults to 10% or 10 GB, whichever is greater. If you would like to change the cache size, you can specify a different limit by modifying the cache_size_mb and/or cache_size_pct settings in the . For example:

global:
  cache_size_mb: 30000
  cache_size_pct: 70

Checking current size of the cache volume

You can check the current size of the cache volume by running:

sudo du -h /var/lib/docker/volumes/earthly-cache | tail -n 1

Resetting the local cache

To reset the cache, you can issue the command

earthly prune

You can also safely delete the cache manually, if the daemon is not running

docker stop earthly-buildkitd
docker rm earthly-buildkitd
docker volume rm earthly-cache

Earthly also has a command that automates the above:

earthly prune --reset

Cache on a remote runner / Earthly Satellite

Configuring the cache size on a remote runner

Resetting the cache on a remote runner

The command earthly prune will work on remote runners too, albeit without the --reset flag, which is not supported in a remote setting.

To cause a satellite to restart with a fresh cache, you can use the command earthly sat update --drop-cache.

Auto-skip cache

The auto-skip cache is a cache that is used to skip large parts of a build in certain situations. It is used by the earthly --auto-skip and BUILD --auto-skip commands.

Unlike the layer cache and the cache mounts, the auto-skip cache is global and is stored in a cloud database.

To clear the entire auto-skip cache for your Earthly org, you can use the command earthly prune-auto-skip.

To clear the auto-skip cache for an entire repository, you can use the command earthly prune-auto-skip --path github.com/foo/bar --deep.

To clear the auto-skip cache for a specific target, you can use the command earthly prune-auto-skip --path github.com/foo/bar --target +my-target.

If you are using , you can simply launch a bigger satellite via the --size flag: earthly sat launch --size ....

If you are using a self-hosted remote runner, you can configure the cache policy by passing the appropriate to the .

📖
configuration
Earthly Satellites
buildkit configuration
buildkit container