docs(images): add config and CLI cleanup documentation
- commit
- 4539f00b41c08ef4faeac9c2eb78ab9e676e8184
- author
- brice · · 2026-02-08 06:58 UTC
- committer
- brice · · 2026-02-08 09:40 UTC
- parent
- b5442e4
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
5 files · +140 -0
A docs/cli/images.md +70 -0
| @@ -0,0 +1,70 @@ | |||
| 1 | + | # Images Command | |
| 2 | + | ||
| 3 | + | List and prune runtime/registry images. | |
| 4 | + | ||
| 5 | + | ## gordon images | |
| 6 | + | ||
| 7 | + | ```bash | |
| 8 | + | gordon images <subcommand> | |
| 9 | + | ``` | |
| 10 | + | ||
| 11 | + | Subcommands: | |
| 12 | + | ||
| 13 | + | - `list` - List runtime images. | |
| 14 | + | - `prune` - Prune dangling runtime images and optionally registry data. | |
| 15 | + | ||
| 16 | + | > **Note:** Images commands require remote mode (`--remote` + `--token`, or configured remotes). | |
| 17 | + | ||
| 18 | + | ## gordon images list | |
| 19 | + | ||
| 20 | + | ```bash | |
| 21 | + | gordon images list | |
| 22 | + | ``` | |
| 23 | + | ||
| 24 | + | Shows image rows with repository, tag, size, creation time, image id, and dangling status. | |
| 25 | + | ||
| 26 | + | ## gordon images prune | |
| 27 | + | ||
| 28 | + | ```bash | |
| 29 | + | gordon images prune [--dry-run] [--keep <n>] [--runtime-only] | |
| 30 | + | ``` | |
| 31 | + | ||
| 32 | + | Flags: | |
| 33 | + | ||
| 34 | + | | Flag | Default | Description | | |
| 35 | + | |------|---------|-------------| | |
| 36 | + | | `--dry-run` | `false` | Show prune behavior without applying changes | | |
| 37 | + | | `--keep` | `0` | Number of latest tags to keep per repository (`0` disables registry cleanup) | | |
| 38 | + | | `--runtime-only` | `false` | Prune dangling runtime images only; forces registry cleanup off | | |
| 39 | + | ||
| 40 | + | Behavior notes: | |
| 41 | + | ||
| 42 | + | - `--runtime-only` forces `keep_last = 0`. | |
| 43 | + | - `--keep` must be `>= 0`. | |
| 44 | + | - `--dry-run` reports what would be pruned. | |
| 45 | + | ||
| 46 | + | ## Examples | |
| 47 | + | ||
| 48 | + | ```bash | |
| 49 | + | # List images | |
| 50 | + | gordon images list | |
| 51 | + | ||
| 52 | + | # Prune dangling runtime images only | |
| 53 | + | gordon images prune --runtime-only | |
| 54 | + | ||
| 55 | + | # Prune runtime images and keep 3 newest tags per repository | |
| 56 | + | gordon images prune --keep 3 | |
| 57 | + | ||
| 58 | + | # Preview cleanup without applying | |
| 59 | + | gordon images prune --dry-run --keep 5 | |
| 60 | + | ``` | |
| 61 | + | ||
| 62 | + | ## Required Permissions | |
| 63 | + | ||
| 64 | + | - `list` requires `admin:status:read`. | |
| 65 | + | - `prune` requires `admin:config:write`. | |
| 66 | + | ||
| 67 | + | ## Related | |
| 68 | + | ||
| 69 | + | - [CLI Commands](./index.md) | |
| 70 | + | - [Images Configuration](../config/images.md) | |
| @@ -0,0 +1,70 @@ | |||||
| 1 | + | # Images Command | |||
| 2 | + | ||||
| 3 | + | List and prune runtime/registry images. | |||
| 4 | + | ||||
| 5 | + | ## gordon images | |||
| 6 | + | ||||
| 7 | + | ```bash | |||
| 8 | + | gordon images <subcommand> | |||
| 9 | + | ``` | |||
| 10 | + | ||||
| 11 | + | Subcommands: | |||
| 12 | + | ||||
| 13 | + | - `list` - List runtime images. | |||
| 14 | + | - `prune` - Prune dangling runtime images and optionally registry data. | |||
| 15 | + | ||||
| 16 | + | > **Note:** Images commands require remote mode (`--remote` + `--token`, or configured remotes). | |||
| 17 | + | ||||
| 18 | + | ## gordon images list | |||
| 19 | + | ||||
| 20 | + | ```bash | |||
| 21 | + | gordon images list | |||
| 22 | + | ``` | |||
| 23 | + | ||||
| 24 | + | Shows image rows with repository, tag, size, creation time, image id, and dangling status. | |||
| 25 | + | ||||
| 26 | + | ## gordon images prune | |||
| 27 | + | ||||
| 28 | + | ```bash | |||
| 29 | + | gordon images prune [--dry-run] [--keep <n>] [--runtime-only] | |||
| 30 | + | ``` | |||
| 31 | + | ||||
| 32 | + | Flags: | |||
| 33 | + | ||||
| 34 | + | | Flag | Default | Description | | |||
| 35 | + | |------|---------|-------------| | |||
| 36 | + | | `--dry-run` | `false` | Show prune behavior without applying changes | | |||
| 37 | + | | `--keep` | `0` | Number of latest tags to keep per repository (`0` disables registry cleanup) | | |||
| 38 | + | | `--runtime-only` | `false` | Prune dangling runtime images only; forces registry cleanup off | | |||
| 39 | + | ||||
| 40 | + | Behavior notes: | |||
| 41 | + | ||||
| 42 | + | - `--runtime-only` forces `keep_last = 0`. | |||
| 43 | + | - `--keep` must be `>= 0`. | |||
| 44 | + | - `--dry-run` reports what would be pruned. | |||
| 45 | + | ||||
| 46 | + | ## Examples | |||
| 47 | + | ||||
| 48 | + | ```bash | |||
| 49 | + | # List images | |||
| 50 | + | gordon images list | |||
| 51 | + | ||||
| 52 | + | # Prune dangling runtime images only | |||
| 53 | + | gordon images prune --runtime-only | |||
| 54 | + | ||||
| 55 | + | # Prune runtime images and keep 3 newest tags per repository | |||
| 56 | + | gordon images prune --keep 3 | |||
| 57 | + | ||||
| 58 | + | # Preview cleanup without applying | |||
| 59 | + | gordon images prune --dry-run --keep 5 | |||
| 60 | + | ``` | |||
| 61 | + | ||||
| 62 | + | ## Required Permissions | |||
| 63 | + | ||||
| 64 | + | - `list` requires `admin:status:read`. | |||
| 65 | + | - `prune` requires `admin:config:write`. | |||
| 66 | + | ||||
| 67 | + | ## Related | |||
| 68 | + | ||||
| 69 | + | - [CLI Commands](./index.md) | |||
| 70 | + | - [Images Configuration](../config/images.md) | |||
M docs/cli/index.md +6 -0
| @@ -30,6 +30,7 @@ Commands are organized by where they run: | |||
| 30 | 30 | | `gordon logs` | Display Gordon process or container logs | [serve](./serve.md#gordon-logs) | | |
| 31 | 31 | | `gordon status` | Show Gordon server status | [status](./status.md) | | |
| 32 | 32 | | `gordon backup` | Manage database backups | [backup](./backup.md) | | |
| 33 | + | | `gordon images` | List and prune images | [images](./images.md) | | |
| 33 | 34 | ||
| 34 | 35 | ## Client Commands | |
| 35 | 36 | ||
| @@ -80,6 +81,11 @@ gordon backup run app.example.com | |||
| 80 | 81 | gordon backup detect app.example.com | |
| 81 | 82 | gordon backup status | |
| 82 | 83 | ||
| 84 | + | # Images | |
| 85 | + | gordon images list | |
| 86 | + | gordon images prune --runtime-only | |
| 87 | + | gordon images prune --keep 3 | |
| 88 | + | ||
| 83 | 89 | # Authentication | |
| 84 | 90 | gordon auth token generate --subject ci-bot --expiry 0 | |
| 85 | 91 | gordon auth token list | |
| @@ -30,6 +30,7 @@ Commands are organized by where they run: | |||||
| 30 | | `gordon logs` | Display Gordon process or container logs | [serve](./serve.md#gordon-logs) | | 30 | | `gordon logs` | Display Gordon process or container logs | [serve](./serve.md#gordon-logs) | | ||
| 31 | | `gordon status` | Show Gordon server status | [status](./status.md) | | 31 | | `gordon status` | Show Gordon server status | [status](./status.md) | | ||
| 32 | | `gordon backup` | Manage database backups | [backup](./backup.md) | | 32 | | `gordon backup` | Manage database backups | [backup](./backup.md) | | ||
| 33 | + | | `gordon images` | List and prune images | [images](./images.md) | | |||
| 33 | 34 | ||||
| 34 | ## Client Commands | 35 | ## Client Commands | ||
| 35 | 36 | ||||
| @@ -80,6 +81,11 @@ gordon backup run app.example.com | |||||
| 80 | gordon backup detect app.example.com | 81 | gordon backup detect app.example.com | ||
| 81 | gordon backup status | 82 | gordon backup status | ||
| 82 | 83 | ||||
| 84 | + | # Images | |||
| 85 | + | gordon images list | |||
| 86 | + | gordon images prune --runtime-only | |||
| 87 | + | gordon images prune --keep 3 | |||
| 88 | + | ||||
| 83 | # Authentication | 89 | # Authentication | ||
| 84 | gordon auth token generate --subject ci-bot --expiry 0 | 90 | gordon auth token generate --subject ci-bot --expiry 0 | ||
| 85 | gordon auth token list | 91 | gordon auth token list | ||
A docs/config/images.md +41 -0
| @@ -0,0 +1,41 @@ | |||
| 1 | + | # Images Configuration | |
| 2 | + | ||
| 3 | + | Configure automatic image cleanup for Docker runtime images and local registry storage. | |
| 4 | + | ||
| 5 | + | ## Overview | |
| 6 | + | ||
| 7 | + | When enabled, Gordon runs a scheduled image prune job that: | |
| 8 | + | ||
| 9 | + | - Prunes dangling runtime images. | |
| 10 | + | - Applies tag retention to registry repositories. | |
| 11 | + | - Preserves the `latest` tag. | |
| 12 | + | - Removes unreferenced blobs after tag cleanup. | |
| 13 | + | ||
| 14 | + | ## Configuration | |
| 15 | + | ||
| 16 | + | ```toml | |
| 17 | + | [images.prune] | |
| 18 | + | enabled = false | |
| 19 | + | schedule = "daily" | |
| 20 | + | keep_last = 3 | |
| 21 | + | ``` | |
| 22 | + | ||
| 23 | + | ## Settings | |
| 24 | + | ||
| 25 | + | | Key | Type | Default | Description | | |
| 26 | + | |-----|------|---------|-------------| | |
| 27 | + | | `images.prune.enabled` | bool | `false` | Enables scheduled image cleanup | | |
| 28 | + | | `images.prune.schedule` | string | `"daily"` | Schedule preset: `hourly`, `daily`, `weekly`, `monthly` | | |
| 29 | + | | `images.prune.keep_last` | int | `3` | Number of newest tags kept per repository during registry cleanup | | |
| 30 | + | ||
| 31 | + | ## Retention Behavior | |
| 32 | + | ||
| 33 | + | - `latest` is always preserved. | |
| 34 | + | - `keep_last` applies per repository. | |
| 35 | + | - `keep_last = 0` skips registry tag/blob cleanup (runtime dangling prune still runs). | |
| 36 | + | - Negative `keep_last` values are invalid. | |
| 37 | + | ||
| 38 | + | ## Related | |
| 39 | + | ||
| 40 | + | - [CLI Images Command](../cli/images.md) | |
| 41 | + | - [Configuration Reference](./reference.md) | |
| @@ -0,0 +1,41 @@ | |||||
| 1 | + | # Images Configuration | |||
| 2 | + | ||||
| 3 | + | Configure automatic image cleanup for Docker runtime images and local registry storage. | |||
| 4 | + | ||||
| 5 | + | ## Overview | |||
| 6 | + | ||||
| 7 | + | When enabled, Gordon runs a scheduled image prune job that: | |||
| 8 | + | ||||
| 9 | + | - Prunes dangling runtime images. | |||
| 10 | + | - Applies tag retention to registry repositories. | |||
| 11 | + | - Preserves the `latest` tag. | |||
| 12 | + | - Removes unreferenced blobs after tag cleanup. | |||
| 13 | + | ||||
| 14 | + | ## Configuration | |||
| 15 | + | ||||
| 16 | + | ```toml | |||
| 17 | + | [images.prune] | |||
| 18 | + | enabled = false | |||
| 19 | + | schedule = "daily" | |||
| 20 | + | keep_last = 3 | |||
| 21 | + | ``` | |||
| 22 | + | ||||
| 23 | + | ## Settings | |||
| 24 | + | ||||
| 25 | + | | Key | Type | Default | Description | | |||
| 26 | + | |-----|------|---------|-------------| | |||
| 27 | + | | `images.prune.enabled` | bool | `false` | Enables scheduled image cleanup | | |||
| 28 | + | | `images.prune.schedule` | string | `"daily"` | Schedule preset: `hourly`, `daily`, `weekly`, `monthly` | | |||
| 29 | + | | `images.prune.keep_last` | int | `3` | Number of newest tags kept per repository during registry cleanup | | |||
| 30 | + | ||||
| 31 | + | ## Retention Behavior | |||
| 32 | + | ||||
| 33 | + | - `latest` is always preserved. | |||
| 34 | + | - `keep_last` applies per repository. | |||
| 35 | + | - `keep_last = 0` skips registry tag/blob cleanup (runtime dangling prune still runs). | |||
| 36 | + | - Negative `keep_last` values are invalid. | |||
| 37 | + | ||||
| 38 | + | ## Related | |||
| 39 | + | ||||
| 40 | + | - [CLI Images Command](../cli/images.md) | |||
| 41 | + | - [Configuration Reference](./reference.md) | |||
M docs/config/index.md +11 -0
| @@ -126,6 +126,12 @@ hourly = 24 | |||
| 126 | 126 | daily = 7 | |
| 127 | 127 | weekly = 4 | |
| 128 | 128 | monthly = 12 | |
| 129 | + | ||
| 130 | + | # Images | |
| 131 | + | [images.prune] | |
| 132 | + | enabled = false | |
| 133 | + | schedule = "daily" | |
| 134 | + | keep_last = 3 | |
| 129 | 135 | ``` | |
| 130 | 136 | ||
| 131 | 137 | ## Configuration Sections | |
| @@ -146,6 +152,7 @@ monthly = 12 | |||
| 146 | 152 | | `[network_groups]` | Shared service networks | [Network Groups](./network-groups.md) | | |
| 147 | 153 | | `[attachments]` | Service dependencies | [Attachments](./attachments.md) | | |
| 148 | 154 | | `[backups]` | Database backups | [Backups](./backups.md) | | |
| 155 | + | | `[images.prune]` | Scheduled image cleanup | [Images](./images.md) | | |
| 149 | 156 | ||
| 150 | 157 | ## Default Values | |
| 151 | 158 | ||
| @@ -182,6 +189,9 @@ monthly = 12 | |||
| 182 | 189 | | `network_isolation.enabled` | `false` | | |
| 183 | 190 | | `auto_route.enabled` | `false` | | |
| 184 | 191 | | `backups.enabled` | `false` | | |
| 192 | + | | `images.prune.enabled` | `false` | | |
| 193 | + | | `images.prune.schedule` | `"daily"` | | |
| 194 | + | | `images.prune.keep_last` | `3` | | |
| 185 | 195 | ||
| 186 | 196 | ## Hot Reload | |
| 187 | 197 | ||
| @@ -223,3 +233,4 @@ Pattern: `GORDON_SECTION_KEY` (uppercase, underscores instead of dots) | |||
| 223 | 233 | - [External Routes](./external-routes.md) | |
| 224 | 234 | - [Authentication](./auth.md) | |
| 225 | 235 | - [Backups](./backups.md) | |
| 236 | + | - [Images](./images.md) | |
| @@ -126,6 +126,12 @@ hourly = 24 | |||||
| 126 | daily = 7 | 126 | daily = 7 | ||
| 127 | weekly = 4 | 127 | weekly = 4 | ||
| 128 | monthly = 12 | 128 | monthly = 12 | ||
| 129 | + | ||||
| 130 | + | # Images | |||
| 131 | + | [images.prune] | |||
| 132 | + | enabled = false | |||
| 133 | + | schedule = "daily" | |||
| 134 | + | keep_last = 3 | |||
| 129 | ``` | 135 | ``` | ||
| 130 | 136 | ||||
| 131 | ## Configuration Sections | 137 | ## Configuration Sections | ||
| @@ -146,6 +152,7 @@ monthly = 12 | |||||
| 146 | | `[network_groups]` | Shared service networks | [Network Groups](./network-groups.md) | | 152 | | `[network_groups]` | Shared service networks | [Network Groups](./network-groups.md) | | ||
| 147 | | `[attachments]` | Service dependencies | [Attachments](./attachments.md) | | 153 | | `[attachments]` | Service dependencies | [Attachments](./attachments.md) | | ||
| 148 | | `[backups]` | Database backups | [Backups](./backups.md) | | 154 | | `[backups]` | Database backups | [Backups](./backups.md) | | ||
| 155 | + | | `[images.prune]` | Scheduled image cleanup | [Images](./images.md) | | |||
| 149 | 156 | ||||
| 150 | ## Default Values | 157 | ## Default Values | ||
| 151 | 158 | ||||
| @@ -182,6 +189,9 @@ monthly = 12 | |||||
| 182 | | `network_isolation.enabled` | `false` | | 189 | | `network_isolation.enabled` | `false` | | ||
| 183 | | `auto_route.enabled` | `false` | | 190 | | `auto_route.enabled` | `false` | | ||
| 184 | | `backups.enabled` | `false` | | 191 | | `backups.enabled` | `false` | | ||
| 192 | + | | `images.prune.enabled` | `false` | | |||
| 193 | + | | `images.prune.schedule` | `"daily"` | | |||
| 194 | + | | `images.prune.keep_last` | `3` | | |||
| 185 | 195 | ||||
| 186 | ## Hot Reload | 196 | ## Hot Reload | ||
| 187 | 197 | ||||
| @@ -223,3 +233,4 @@ Pattern: `GORDON_SECTION_KEY` (uppercase, underscores instead of dots) | |||||
| 223 | - [External Routes](./external-routes.md) | 233 | - [External Routes](./external-routes.md) | ||
| 224 | - [Authentication](./auth.md) | 234 | - [Authentication](./auth.md) | ||
| 225 | - [Backups](./backups.md) | 235 | - [Backups](./backups.md) | ||
| 236 | + | - [Images](./images.md) | |||
M docs/config/reference.md +12 -0
| @@ -141,6 +141,14 @@ daily = 0 # Keep N daily backups per DB | |||
| 141 | 141 | weekly = 0 # Keep N weekly backups per DB | |
| 142 | 142 | monthly = 0 # Keep N monthly backups per DB | |
| 143 | 143 | ||
| 144 | + | # ============================================================================= | |
| 145 | + | # IMAGES | |
| 146 | + | # ============================================================================= | |
| 147 | + | [images.prune] | |
| 148 | + | enabled = false # Enable scheduled image cleanup | |
| 149 | + | schedule = "daily" # "hourly", "daily", "weekly", "monthly" | |
| 150 | + | keep_last = 3 # Keep N newest tags per repository | |
| 151 | + | ||
| 144 | 152 | # Note: retention values set to 0 keep no backups for that tier. | |
| 145 | 153 | # For practical defaults, consider setting daily = 7. | |
| 146 | 154 | ``` | |
| @@ -197,6 +205,9 @@ monthly = 0 # Keep N monthly backups per DB | |||
| 197 | 205 | | `backups.retention.daily` | `0` | Keep no daily backups by default (recommend `7`) | | |
| 198 | 206 | | `backups.retention.weekly` | `0` | Keep no weekly backups by default | | |
| 199 | 207 | | `backups.retention.monthly` | `0` | Keep no monthly backups by default | | |
| 208 | + | | `images.prune.enabled` | `false` | Scheduled image cleanup disabled | | |
| 209 | + | | `images.prune.schedule` | `"daily"` | Cleanup schedule preset | | |
| 210 | + | | `images.prune.keep_last` | `3` | Number of recent tags kept per repository | | |
| 200 | 211 | ||
| 201 | 212 | Note: for all `backups.retention.*` keys, `0` means keep no backups for that retention tier. | |
| 202 | 213 | ||
| @@ -269,3 +280,4 @@ gordon serve | |||
| 269 | 280 | - [Authentication](./auth.md) | |
| 270 | 281 | - [Network Isolation](./network-isolation.md) | |
| 271 | 282 | - [Volumes](./volumes.md) | |
| 283 | + | - [Images](./images.md) | |
| @@ -141,6 +141,14 @@ daily = 0 # Keep N daily backups per DB | |||||
| 141 | weekly = 0 # Keep N weekly backups per DB | 141 | weekly = 0 # Keep N weekly backups per DB | ||
| 142 | monthly = 0 # Keep N monthly backups per DB | 142 | monthly = 0 # Keep N monthly backups per DB | ||
| 143 | 143 | ||||
| 144 | + | # ============================================================================= | |||
| 145 | + | # IMAGES | |||
| 146 | + | # ============================================================================= | |||
| 147 | + | [images.prune] | |||
| 148 | + | enabled = false # Enable scheduled image cleanup | |||
| 149 | + | schedule = "daily" # "hourly", "daily", "weekly", "monthly" | |||
| 150 | + | keep_last = 3 # Keep N newest tags per repository | |||
| 151 | + | ||||
| 144 | # Note: retention values set to 0 keep no backups for that tier. | 152 | # Note: retention values set to 0 keep no backups for that tier. | ||
| 145 | # For practical defaults, consider setting daily = 7. | 153 | # For practical defaults, consider setting daily = 7. | ||
| 146 | ``` | 154 | ``` | ||
| @@ -197,6 +205,9 @@ monthly = 0 # Keep N monthly backups per DB | |||||
| 197 | | `backups.retention.daily` | `0` | Keep no daily backups by default (recommend `7`) | | 205 | | `backups.retention.daily` | `0` | Keep no daily backups by default (recommend `7`) | | ||
| 198 | | `backups.retention.weekly` | `0` | Keep no weekly backups by default | | 206 | | `backups.retention.weekly` | `0` | Keep no weekly backups by default | | ||
| 199 | | `backups.retention.monthly` | `0` | Keep no monthly backups by default | | 207 | | `backups.retention.monthly` | `0` | Keep no monthly backups by default | | ||
| 208 | + | | `images.prune.enabled` | `false` | Scheduled image cleanup disabled | | |||
| 209 | + | | `images.prune.schedule` | `"daily"` | Cleanup schedule preset | | |||
| 210 | + | | `images.prune.keep_last` | `3` | Number of recent tags kept per repository | | |||
| 200 | 211 | ||||
| 201 | Note: for all `backups.retention.*` keys, `0` means keep no backups for that retention tier. | 212 | Note: for all `backups.retention.*` keys, `0` means keep no backups for that retention tier. | ||
| 202 | 213 | ||||
| @@ -269,3 +280,4 @@ gordon serve | |||||
| 269 | - [Authentication](./auth.md) | 280 | - [Authentication](./auth.md) | ||
| 270 | - [Network Isolation](./network-isolation.md) | 281 | - [Network Isolation](./network-isolation.md) | ||
| 271 | - [Volumes](./volumes.md) | 282 | - [Volumes](./volumes.md) | ||
| 283 | + | - [Images](./images.md) | |||