buildx prune

buildx prune is a command to remove unused Buildx build artifacts. These artifacts can include images, build contexts, and caches. This can help to free up disk space and improve performance.

Usage

buildx prune [OPTIONS]
          

Options

  • --all: Remove all Buildx artifacts, even those that are currently in use.
  • --force: Remove artifacts without prompting for confirmation.
  • --filter: Filter the artifacts that are removed. This option accepts a list of filters that can be combined.
  • --help: Display help for the command.

Examples

Removing all unused Buildx artifacts

buildx prune --all
          

This command will remove all unused Buildx artifacts, including images, build contexts, and caches.

Removing unused Buildx images

buildx prune --filter type=image
          

This command will remove all unused Buildx images.

Removing unused Buildx build contexts

buildx prune --filter type=context
          

This command will remove all unused Buildx build contexts.

Removing unused Buildx caches

buildx prune --filter type=cache
          

This command will remove all unused Buildx caches.

Removing unused Buildx artifacts in a specific builder

buildx prune --filter builder=my-builder
          

This command will remove all unused Buildx artifacts in the my-builder builder.

Removing unused Buildx artifacts created in the last 24 hours

buildx prune --filter created-since=24h
          

This command will remove all unused Buildx artifacts that were created in the last 24 hours.

Source