Open stavros-k opened 1 month ago
This is the expected behavior; docker system prune
is meant to remove all unused objects. The --volumes
flag was added as a "safety" options, because volumes are normally used to store persistent data, which may be important data (e.g. data for a database); in some cases such volumes may not be currently used, but still important.
If you want to only prune volumes, use docker volumes prune
instead.
From the documentation; https://docs.docker.com/reference/cli/docker/system/prune/#description
The command description could probably use some improving though, because it only prints the short description (Remove unused data
); maybe we can make the commands use the long description (if available);
docker system prune --help
Usage: docker system prune [OPTIONS]
Remove unused data
Options:
-a, --all Remove all unused images not just dangling ones
--filter filter Provide filter values (e.g. "label=<key>=<value>")
-f, --force Do not prompt for confirmation
--volumes Prune anonymous volumes
Description
Running
docker system prune --volumes
removes also networks and images.Reproduce
docker system prune --volumes
Expected behavior
docker system prune --volumes
to remove only volumesdocker version
docker info
Additional Info