Search or ask Docker

sbx template prune

View Markdown
DescriptionRemove unused template images
Usagesbx template prune [flags]

Description

Remove unused digest-only and untagged images from the local image store.

Images referenced by running or stopped sandboxes, in-flight operations, or retained image dependencies are protected. This does not remove sandboxes. Use --all to also remove unused tagged images, including saved templates.

Use --filter until=TIMESTAMP to remove only image references created before a timestamp or duration before now. Use --dry-run to preview the selection. Images that change or become referenced after confirmation are skipped. Space recovery may be delayed by shared layers or runtime leases.

Local-only: cloud template pruning is not supported.

Options

OptionDefaultDescription
-a, --allAlso remove unused tagged images, including saved templates
--dry-runList the images that would be removed without removing them
--filterFilter candidates (supported: until=TIMESTAMP — created before TIMESTAMP)
-f, --forceSkip confirmation prompts
--formatOutput format: table, json or yaml
--jsonOutput in JSON format

Global options

OptionDefaultDescription
--cloudDispatch to Docker Cloud Sandboxes API instead of local sandboxd (supported by a growing set of verbs — run 'sbx --cloud --help' for the current list)
-D, --debugEnable debug logging
--no-inputNever prompt; commands that need an answer fail with the command to run instead

Examples

# Preview unused digest-only and untagged images
sbx template prune --dry-run

# Remove all unused images older than a week
sbx template prune --all --filter until=168h

# Remove unused images without confirmation
sbx template prune --all --force

# Output the preview as JSON
sbx template prune --all --dry-run --format json