加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Docker在构建映像时无法删除文件

发布时间:2020-12-16 03:25:28 所属栏目:安全 来源:网络整理
导读:我的DockerFile包含以下指令: rm -f plugins.7z 该命令在Docker的早期版本中按预期工作,但在1.13版本中失败.我看到错误: cannot access plugins.7z: No such file or directory 如果我用基本映像调出一个容器并手动执行命令,则会看到相同的错误. 尝试列出

我的DockerFile包含以下指令:

rm -f plugins.7z

该命令在Docker的早期版本中按预期工作,但在1.13版本中失败.我看到错误:

cannot access plugins.7z: No such file or directory

如果我用基本映像调出一个容器并手动执行命令,则会看到相同的错误.

尝试列出文件夹内容时显示:

# ls -lrt
  ls: cannot access plugins.7z: No such file or directory
  total 12
  ???????????   ? ?          ?             ?            ? plugins.7z

在Docker Issues中未将其列为已知问题.如何进一步调试问题?

编辑:

>由于IP的原因,我无法在此处发布完整的Dockerfile.另外,可能没有必要.如前所述,即使手动运行容器并尝试执行命令,我也可以模拟问题
>该文件存在,然后尝试删除它
>我错在问题列表中没有类似的错误.这是one
>问题可能与该文件无关.删除文件夹中的其他文件/文件夹也会使它们显示为???.权限
>执行操作的用户是root

最佳答案
删除目录失败的原因是未使用d_type支持(“ ftype = 1”)格式化支持(xfs)文件系统.您可以在github上找到讨论; https://github.com/docker/docker/issues/27358.

要验证d_type支持在您的系统上是否可用,请检查docker info的输出;

Server Version: 1.13.1
Storage Driver: overlay
 Backing Filesystem: xfs
 Supports d_type: false
Logging Driver: json-file

该要求也描述在release notes for RHEL/CentOS中

Note that XFS file systems must be created with the -n ftype=1 option enabled for use as an overlay. With the rootfs and any file systems created during system installation,set the --mkfsoptions=-n ftype=1 parameters in the Anaconda kickstart. When creating a new file system after the installation,run the # mkfs -t xfs -n ftype=1 /PATH/TO/DEVICE command. To determine whether an existing file system is eligible for use as an overlay,run the # xfs_info /PATH/TO/DEVICE | grep ftype command to see if the ftype=1 option is enabled.

要解决此问题,请;或者;

>使用ftype = 1重新格式化设备
>使用其他存储驱动程序.请注意,不建议将默认设备映射器配置(使用环回设备)用于生产,因此需要手动配置.

对于向后兼容性(较早版本的docker允许在没有d_type的系统上运行叠加),docker 1.13将仅在守护程序日志中记录警告(https://github.com/docker/docker/pull/27433),但在以后的版本中将不再支持.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读