Docker正在大量使用中,但没有任何Docker容器 [英] Docker is in volume in use, but there aren't any Docker containers

查看:64
本文介绍了Docker正在大量使用中,但没有任何Docker容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑(2/19/21):自从几年前我问这个原始问题以来,已经过去了很多时间,从那时起,我看到了一系列的活动.我重新选择了一个我认为与解决该问题的最本地化和最安全的选项一致的答案(通常与docker-compose相关联).尽管docker确实引入了 prune 命令,但这通常是一种危险的操作,我会谨慎使用它,因为您可能会无意中影响计算机上的其他应用程序或设置

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卷时,我一直遇到问题.

I've been having issues with removing Docker volumes with Docker 1.9.1.

我已经删除了所有停止的容器,以便 docker ps -a 返回空.

I've removed all my stopped containers so that docker ps -a returns empty.

当我使用 docker volume ls 时,会得到一整堆Docker容器:

When I use docker volume ls, I'm given a whole host of Docker containers:

docker volume ls
DRIVER              VOLUME NAME
local               a94211ea91d66142886d72ec476ece477bb5d2e7e52a5d73b2f2f98f6efa6e66
local               4f673316d690ca2d41abbdc9bf980c7a3f8d67242d76562bbd44079f5f438317
local               eb6ab93effc4b90a2162e6fab6eeeb65bd0e4bd8a9290e1bad503d2a47aa8a78
local               91acb0f7644aec16d23a70f63f70027899017a884dab1f33ac8c4cf0dabe5f2c
local               4932e2fbad8f7e6246af96208d45a266eae11329f1adf176955f80ca2e874f69
local               68fd38fc78a8f02364a94934e9dd3b5d10e51de5b2546e7497eb21d6a1e7b750
local               7043a9642614dd6e9ca013cdf662451d2b3df6b1dddff97211a65ccf9f4c6d47
#etc x 50

由于这些卷都不包含任何重要内容,因此我尝试使用 docker volume rm $(docker volume ls -q)清除所有卷.

Since none of these volumes contain anything important, I try to purge all the volumes with docker volume rm $(docker volume ls -q).

在此过程中,大多数都被删除了,但我回来了:

In the process, the majority are removed, but I get back:

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

其中很大一部分.如果我一开始没有任何容器,这些卷将如何使用?

For a sizeable portion of them. If I don't have any containers existing in the first place, how are these volumes being used?

推荐答案

也许该卷是通过 docker-compose 创建的?如果是这样,应该通过以下方式删除:

Perhaps the volume was created via docker-compose? If so, it should get removed by:

docker-compose down --volumes


信用至 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆