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

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.

主站蜘蛛池模板: 芒康县| 顺昌县| 西乡县| 荣昌县| 宜宾县| 琼结县| 奉节县| 鄱阳县| 南昌市| 齐齐哈尔市| 什邡市| 金塔县| 凤阳县| 上虞市| 长顺县| 北宁市| 沙湾县| 平和县| 禄劝| 宝应县| 伊吾县| 南昌市| 宾川县| 建德市| 虞城县| 华宁县| 海林市| 肥乡县| 呼玛县| 漳平市| 长宁区| 临邑县| 南丹县| 汕头市| 错那县| 习水县| 塔城市| 基隆市| 玛多县| 格尔木市| 黄平县|