Centos7.2下Dockerfile执行rm提示rm: cannot remove分析

Centos7.2下Dockerfile执行rm提示rm: cannot remove xxx Directory not empty问题分析

Dockerfile执行rm操作,docker build最后提示rm: cannot remove xxx Directory not empty
rm: can’t remove ‘/opt/nginx’: Directory not empty
rm: can’t remove ‘/opt/openssl’: Directory not empty

经过一番搜索查找,github上有人提过,可以参考
https://github.com/docker/docker/issues/31717
https://github.com/docker/docker/issues/27358
https://github.com/docker/docker/issues/27214

是Centos7.2的内核有BUG,也可以说是和docker版本不兼容,Centos7.3已修复,详细见:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/7.2_Release_Notes/technology-preview-file_systems.html

检查分区是否是xfs
df -T

再检查ftype是否为1,如果是0那就有这个问题
xfs_info /dev/sda1| grep ftype

检查docker存储驱动程序,一般默认是overlay
docker info |grep “Storage Driver”

解决方法有三个:
1. 对docker使用分区重新分区 mkfs -t xfs -n ftype=1 /PATH/TO/DEVICE
2. 重新装centos 7.3系统
3. 修改docker存储驱动程序,修改 /etc/systemd/system/docker.service配置,这项:
ExecStart=/usr/bin/dockerd –storage-driver=devicemapper
增加这个–storage-driver=devicemapper,需restart生效,如下:
systemctl daemon-reload
service docker restart

20170315151912

注意:修改docker存储驱动程序,会导致docker下的容器和镜像全部丢失,需重新pull.

未经允许不得转载:Ppabc博客 » Centos7.2下Dockerfile执行rm提示rm: cannot remove分析

相关推荐

    暂无内容!