清理docker/overlay2/是否安全? [英] Is it safe to clean docker/overlay2/

查看:106
本文介绍了清理docker/overlay2/是否安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在AWS EC2上运行了一些Docker容器,/var/lib/docker/overlay2文件夹的磁盘大小增长非常快.

I got some docker containers running on AWS EC2, the /var/lib/docker/overlay2 folder grows very fast in disk size.

我想知道删除其内容是否安全?或者docker是否具有某种命令来释放磁盘使用量.

I'm wondering if it is safe to delete its content? or if docker has some kind of command to free up some disk usage.

更新:

我实际上已经尝试过 docker system prune -a ,它回收了0Kb.

I actually tried docker system prune -a already, which reclaimed 0Kb.

我的/docker/overlay2磁盘大小也远大于 docker system df

Also my /docker/overlay2 disk size is much larger than the output from docker system df

阅读docker文档和BMitch的答案后,我认为触摸此文件夹是一个愚蠢的主意,我将尝试其他方法来回收我的磁盘空间.

After reading docker documentation and BMitch's answer, I believe it is a stupid idea to touch this folder and I will try other ways to reclaim my disk space.

推荐答案

Docker使用/var/lib/docker存储您的映像,容器和本地命名卷.删除此内容可能会导致数据丢失,并可能使引擎停止运行.overlay2子目录专门包含用于图像和容器的各种文件系统层.

Docker uses /var/lib/docker to store your images, containers, and local named volumes. Deleting this can result in data loss and possibly stop the engine from running. The overlay2 subdirectory specifically contains the various filesystem layers for images and containers.

要清除未使用的容器和映像,请参阅 docker system prune .还有一些选项可以删除卷甚至是已标记的图像,但是由于可能会丢失数据,因此默认情况下未启用它们.

To cleanup unused containers and images, see docker system prune. There are also options to remove volumes and even tagged images, but they aren't enabled by default due to the possibility of data loss.

这篇关于清理docker/overlay2/是否安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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