如何清理docker overlay目录? [英] how to clean up docker overlay directory?

查看:2569
本文介绍了如何清理docker overlay目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过CoreOS和AWS的ECS运行docker.我有一个失败的映像,该映像已重新启动了许多次,并且容器仍然存在-它们充满了我的驱动器分区.具体来说,/var/lib/docker/overlay/包含大量文件/目录.

I'm running docker via CoreOS and AWS's ECS. I had a failing image that got restarted many times, and the containers are still around- they filled my drive partition. Specifically, /var/lib/docker/overlay/ contains a large number of files/directories.

我知道 docker-cleanup-volumes 是一回事,但它清理了/volumes目录,而不是/overlay目录.

I know that docker-cleanup-volumes is a thing, but it cleans the /volumes directory, not the /overlay directory.

docker ps -a显示了我的坏docker容器上超过250次启动尝试.但是,它们没有运行.

docker ps -a shows over 250 start attempts on my bad docker container. They aren't running, though.

除了rm -rf /var/lib/docker/overlay/*,我/应该如何清理?

Aside from rm -rf /var/lib/docker/overlay/*, how can I/should I clean this up?

推荐答案

在我们这边,我们使用了:

From our side we used:

sudo docker system prune -a -f

哪一个能救我3Go!

我们也使用著名的命令:

We use also the famous commands :

sudo docker rm -v $(sudo docker ps -a -q -f status=exited)
sudo docker rmi -f  $(sudo docker images -f "dangling=true" -q)
docker volume ls -qf dangling=true | xargs -r docker volume rm

我们将其放在cron上,以更有效地管理我们的磁盘空间.

We put that on cron to manage a little bit more efficently our disk space.

欢呼

参考: https://forums.docker.com/t/some-way-to-clean-up-identify-contents-of-var-lib-docker-overlay/30604/4

这篇关于如何清理docker overlay目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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