-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
Description
The doc for docker system prune does not say it will remove build cache:
https://docs.docker.com/reference/cli/docker/system/prune/
Remove all unused containers, networks, images (both dangling and unused), and optionally, volumes.
However, empirically this will delete cache mounts, such as those created using --mount=type=cache,...
in your Dockerfile.
The text for the command does hint at it:
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- unused build cache
I am not sure what would make a cache mount "used" or not (fundamentally they do not contribute to images directly, they are only used in the build process - so are they always "unused").
The doc should be updated to clarify that, and in general make it clearer how builder cache cleaning works under buildx.
Reproduce
run docker system prune with cache mounts
Expected behavior
No response
docker version
Docker version 28.2.2, build e6534b4
though my issue is about the public doc
docker info
Client: Docker Engine - Community
Version: 28.2.2
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.24.0
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.36.2
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 28
Running: 28
Paused: 0
Stopped: 0
Images: 9
Server Version: 28.2.2
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
CDI spec directories:
/etc/cdi
/var/run/cdi
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
runc version: v1.2.5-0-g59923ef
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.11.0-26-generic
Operating System: Ubuntu 24.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 32
Total Memory: 188.3GiB
Name: p16
ID: e8deb74d-602b-4320-957b-558793199fdf
Docker Root Dir: /mnt/docker-data/docker
Debug Mode: false
Experimental: false
Insecure Registries:
::1/128
127.0.0.0/8
Live Restore Enabled: false
Additional Info
The wrong doc also seems to confuse AI agents, who mostly think docker system prune
will not delete cache mounts.