# sbx template prune

**Description:** Remove unused template images

**Usage:** `sbx 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

| Option | Default | Description |
|--------|---------|-------------|
| `-a`, `--all` |  | Also remove unused tagged images, including saved templates |
| `--dry-run` |  | List the images that would be removed without removing them |
| `--filter` |  | Filter candidates (supported: until=TIMESTAMP — created before TIMESTAMP) |
| `-f`, `--force` |  | Skip confirmation prompts |
| `--format` |  | Output format: table, json or yaml |
| `--json` |  | Output in JSON format |



## Global options

| Option | Default | Description |
|--------|---------|-------------|
| `--cloud` |  | Dispatch 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`, `--debug` |  | Enable debug logging |
| `--no-input` |  | Never prompt; commands that need an answer fail with the command to run instead |



## Examples

```console
# 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
```

