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

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.

主站蜘蛛池模板: 云阳县| 恭城| 延长县| 长沙市| 奈曼旗| 平潭县| 西吉县| 盐山县| 棋牌| 西吉县| 梓潼县| 佛坪县| 泾川县| 深水埗区| 额济纳旗| 晋中市| 海伦市| 法库县| 文化| 和政县| 友谊县| 凌源市| 香港 | 武邑县| 普洱| 抚宁县| 格尔木市| 玉门市| 湄潭县| 来安县| 庄浪县| 新泰市| 玉溪市| 白玉县| 泸定县| 岱山县| 满城县| 淄博市| 普定县| 广灵县| 蒙城县|