EDIT (2/19/21): A lot of time has elapsed since I asked this original question years ago and I've seen a flurry of activity since then. I re-selected an answer which I think is consistent with the most localized and safe option for solving this issue (which is typically associated with docker-compose). While docker did introduce the prune command, it is generally a dangerous operation and I would be cautious about using it as you may unintentionally impact other applications or setups you have on your machine
我在使用Docker 1.9.1删除Docker卷时遇到了一些问题。
我已经删除了所有停止的容器,因此docker ps -a返回空。
当我使用docker卷ls时,我得到了一大堆docker容器:
docker volume ls
DRIVER VOLUME NAME
local a94211ea91d66142886d72ec476ece477bb5d2e7e52a5d73b2f2f98f6efa6e66
local 4f673316d690ca2d41abbdc9bf980c7a3f8d67242d76562bbd44079f5f438317
local eb6ab93effc4b90a2162e6fab6eeeb65bd0e4bd8a9290e1bad503d2a47aa8a78
local 91acb0f7644aec16d23a70f63f70027899017a884dab1f33ac8c4cf0dabe5f2c
local 4932e2fbad8f7e6246af96208d45a266eae11329f1adf176955f80ca2e874f69
local 68fd38fc78a8f02364a94934e9dd3b5d10e51de5b2546e7497eb21d6a1e7b750
local 7043a9642614dd6e9ca013cdf662451d2b3df6b1dddff97211a65ccf9f4c6d47
#etc x 50
由于这些卷都不包含任何重要的内容,我尝试使用docker卷rm $(docker卷ls -q)清除所有卷。
在这个过程中,大部分都被删除了,但我得到了:
Error response from daemon: Conflict: volume is in use
Error response from daemon: Conflict: volume is in use
Error response from daemon: Conflict: volume is in use
Error response from daemon: Conflict: volume is in use
Error response from daemon: Conflict: volume is in use
他们中的很大一部分人。如果我一开始就没有任何容器存在,那么如何使用这些卷呢?