Docker volumes are stored in a part of the host filesystem which mounted on Docker containers. During the testing or development process, we can quickly accumulate numerous unused volumes that take a disk space and can be removed. This tutorial demonstrates how to remove Docker volume.
To remove volume by its name, use
docker volume command with
rm argument. For example, to remove a volume named
test_volume, use the following command:
docker volume rm test_volume
Note that cannot to remove a volume that is used by Docker container.
Remove multiple volumes
There is a way to remove multiple volumes at a time by specifying the name of the volumes.
docker volume rm test_volume1 test_volume2