docker buildx prune


Remove build cache

Usage

$ docker buildx prune

Refer to the options section for an overview of available OPTIONS for this command.

Description

Clears the build cache of the selected builder.

You can finely control what cache data is kept using:

  • The --filter=until=<duration> flag to keep images that have been used in the last <duration> time.

    <duration> is a duration string, e.g. 24h or 2h30m, with allowable units of (h)ours, (m)inutes and (s)econds.

  • The --keep-storage=<size> flag to keep <size> bytes of data in the cache.

    <size> is a human-readable memory string, e.g. 128mb, 2gb, etc. Units are case-insensitive.

  • The --all flag to allow clearing internal helper images and frontend images set using the #syntax= directive or the BUILDKIT_SYNTAX build argument.

For example uses of this command, refer to the examples section below.

Options

Name, shorthand Default Description
--all , -a Include internal/frontend images
--filter Provide filter values (e.g., until=24h)
--force , -f Do not prompt for confirmation
--keep-storage Amount of disk space to keep for cache
--verbose Provide a more verbose output
--builder Override the configured builder instance

Examples

Override the configured builder instance (--builder)

Same as buildx --builder.

Parent command

Command Description
docker buildx Docker Buildx
Command Description
docker buildx bake Build from a file
docker buildx build Start a build
docker buildx create Create a new builder instance
docker buildx du Disk usage
docker buildx imagetools Commands to work on images in registry
docker buildx inspect Inspect current builder instance
docker buildx ls List builder instances
docker buildx prune Remove build cache
docker buildx rm Remove a builder instance
docker buildx stop Stop builder instance
docker buildx use Set the current builder instance
docker buildx version Show buildx version information