Docker 驱动程序 "overlay2"未能删除根文件系统 : unlinkat - device or resource busy

标签 docker centos docker-container

尝试删除 docker 容器时(例如尝试 docker-compose down 时),我总是收到以下错误:

ERROR: for <my_container>  container d8424f80ef124c2f3dd8f22a8fe8273f294e8e63954e7f318db93993458bac27: driver "overlay2" failed to remove root filesystem: unlinkat /var/lib/docker/overlay2/64311f2ee553a5d42291afa316db7aa392a29687ffa61971b4454a9be026b3c4/merged: device or resource busy
重启 docker 服务、修剪或强制移除容器等常见建议不起作用。我发现唯一可行的方法是使用 sudo umount /home/virtfs/xxxxx/var/lib/docker/overlay2/<container_id>/merged 手动卸载,然后我可以删除容器。
我的操作系统是 CentOS Linux release 7.9.2009 (Core)内核版本 3.10.0-1127.19.1.el7.x86_64 .我认为这可能是由于 overlay2 与 CentOS 发生冲突,但根据 this page我的 CentOS/内核版本应该可以工作。很高兴能找到解决方案,因为我理想情况下想要 docker-compose down无需使用提升的权限预先卸载。

最佳答案

从错误日志中观察到涉及文件挂载
执行以下命令查看相关进程

grep 64311f2ee553a5d42291afa316db7aa392a29687ffa61971b4454a9be026b3c4 /proc/*/mountinfo
ps -ef | grep "The process ID obtained by the grep command above" 
停止被占用的进程
然后删除容器

关于Docker 驱动程序 "overlay2"未能删除根文件系统 : unlinkat - device or resource busy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70971507/

相关文章:

Centos8.1 上 Virtual Box Yum 安装错误

python - 在 Flask 应用程序中获取 Docker ID

docker - Docker --storage-opt size 与容器实际磁盘使用情况的关系

docker - 有自定义操作时如何使用docker image tensorflow/serving服务tensorflow模型?

ubuntu - 如何在 linux (ubuntu/centos) 中使用特定端口启动 docker 服务

docker - 备份 docker 卷 - 简单的 tar 归档还不够吗?

docker - 为什么我必须删除 docker 容器?

nginx - Vagrant Docker Nginx 解决缓慢

linux - 如何使用外部字符串在 cron 作业中运行命令

mysql - 关闭mysql端口: 3306 and make it local