|
1 | 1 | --- |
2 | 2 | description: Free up disk space by removing unused resources with the prune command |
3 | | -keywords: pruning, prune, images, volumes, containers, networks, disk, administration, |
| 3 | +keywords: |
| 4 | + pruning, prune, images, volumes, containers, networks, disk, administration, |
4 | 5 | garbage collection |
5 | 6 | title: Prune unused Docker objects |
6 | 7 | aliases: |
7 | | -- /engine/admin/pruning/ |
8 | | -- /config/pruning/ |
| 8 | + - /engine/admin/pruning/ |
| 9 | + - /config/pruning/ |
9 | 10 | --- |
10 | 11 |
|
11 | 12 | Docker takes a conservative approach to cleaning up unused objects (often |
@@ -143,6 +144,35 @@ Other filtering expressions are available. See the |
143 | 144 | [`docker network prune` reference](/reference/cli/docker/network/prune/) |
144 | 145 | for more examples. |
145 | 146 |
|
| 147 | +## Prune build cache |
| 148 | + |
| 149 | +The build cache is used by the BuildKit builder to speed up subsequent builds. |
| 150 | +Over time, this cache can grow large. Use `docker builder prune` to remove |
| 151 | +dangling build cache — cache that isn't associated with any current build: |
| 152 | + |
| 153 | +```console |
| 154 | +$ docker builder prune |
| 155 | + |
| 156 | +WARNING! This will remove all dangling build cache. |
| 157 | +Are you sure you want to continue? [y/N] y |
| 158 | +``` |
| 159 | + |
| 160 | +By default, you're prompted to continue. To bypass the prompt, use the `-f` or |
| 161 | +`--force` flag. |
| 162 | + |
| 163 | +To remove all build cache, not just dangling cache, use the `--all` flag: |
| 164 | + |
| 165 | +```console |
| 166 | +$ docker builder prune --all |
| 167 | + |
| 168 | +WARNING! This will remove all build cache. |
| 169 | +Are you sure you want to continue? [y/N] y |
| 170 | +``` |
| 171 | + |
| 172 | +Other filtering expressions are available. See the |
| 173 | +[`docker builder prune` reference](/reference/cli/docker/builder/prune/) |
| 174 | +for more examples. |
| 175 | + |
146 | 176 | ## Prune everything |
147 | 177 |
|
148 | 178 | The `docker system prune` command is a shortcut that prunes images, containers, |
|
0 commit comments