官术网_书友最值得收藏!

Removing volumes

To remove existing named or anonymous volumes using the docker volume rm command, they cannot be used in any container (even stopped ones). The standard procedure would be as follows:

docker stop <containerId>
docker rm <containerId>
docker volume rm <volumeId>

For anonymous volumes, if you use the --rm flag for the docker run command, the container will be removed on exit, along with its anonymous volumes. This flag should be used depending on the scenario in most cases, it is useful for testing and development purposes to make cleanup easier.

During development, you may occasionally need to perform a full cleanup of all of the volumes on your Docker host, for example, if you need to free disk space. The Docker CLI provides a dedicated command that will remove any volumes that are not used in any container:

docker volume prune

Next, we will take a look at bind mounts and how they differ from volumes.

主站蜘蛛池模板: 舒兰市| 清徐县| 青阳县| 赤城县| 山阳县| 十堰市| 浙江省| 东海县| 罗山县| 正镶白旗| 金昌市| 南昌县| 清水县| 佳木斯市| 叶城县| 仙桃市| 宿迁市| 南漳县| 尚志市| 山东省| 得荣县| 沛县| 临湘市| 武邑县| 徐州市| 邹城市| 辰溪县| 吉林市| 兴和县| 黑河市| 兖州市| 安陆市| 林西县| 义乌市| 阿拉善左旗| 武平县| 昌图县| 宁城县| 尤溪县| 林甸县| 灵武市|