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

编程入门 行业动态 更新时间:2024-10-11 11:21:29
本文介绍了Docker在构建映像时无法删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的DockerFile包含以下指令:

My DockerFile contains the following instruction:

rm -f plugins.7z

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

This command worked as expected in earlier versions of docker but fails with version 1.13. I see the error:

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

如果我打开一个带有基本映像的容器并手动执行命令,则会看到相同的错误。

If I bring up a container with the base image and execute the command manually, I see the same error.

试图列出文件夹内容显示:

Trying to list the folder contents displays:

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

在 Docker问题。如何进一步调试问题?

This is not listed as a known issue in Docker Issues. How do I debug the issue further?

编辑:

  • 出于IP的原因,我无法发布完整的Dockerfile这里。同样,可能没有必要。如前所述,即使手动运行容器并尝试执行命令,我也可以模拟问题。
  • 在尝试删除该文件之前,该文件已存在
  • 我错了,因为问题列表中没有类似的错误。这是一个
  • 该问题可能不会与该文件有关。删除文件夹中的其他文件/文件夹也会使它们显示为???。权限
  • 执行操作的用户是root
  • For reasons of IP, I cannot post the full Dockerfile here. Also, it may not be necessary. As I mentioned, I am able to simulate the issue even by manually running the container and trying to execute the command
  • The file exists before I attempt to delete it
  • I was wrong about there not being a similar bug in the issues list. Here is one
  • The issue may not be to do with that file. Deleting other files/folders in the folder also makes them appear with ??? permissions
  • The user performing the operation is root
  • 推荐答案

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

    The reason removing directories fails is that the backing (xfs) filesystem was not formatted with d_type support ("ftype=1"); you can find a discussion on github; github/docker/docker/issues/27358.

    要验证系统上是否提供 d_type 支持,请检查 docker的输出信息;

    To verify if d_type support is available on your system, check the output of docker info;

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

    RHEL / CentOS的发行说明

    请注意,必须使用 -n ftype = 1 选项已启用,可以用作叠加层。使用rootfs和在系统安装期间创建的任何文件系统,在Anaconda kickstart中设置-mkfsoptions = -n ftype = 1 参数。安装后创建新文件系统时,运行#mkfs -t xfs -n ftype = 1 / PATH / TO / DEVICE 命令。要确定现有文件系统是否适合用作覆盖,请运行#xfs_info / PATH / TO / DEVICE | grep ftype 命令查看是否启用了 ftype = 1 选项。

    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
    • 使用其他存储驱动程序。请注意,不建议将默认设备映射器配置(使用环回设备)用于生产,因此需要手动配置。

    -compatibility(较旧版本的docker允许在没有 d_type 的系统上运行叠加),docker 1.13只会在守护程序日志中记录 warning ( github/docker/docker/pull/27433 ),但不会在以后的版本中不再受支持。

    For backward-compatibility (older versions of docker allowed running overlay on systems without d_type), docker 1.13 will only log a warning in the daemon logs (github/docker/docker/pull/27433), but will no longer be supported in a future version.

    更多推荐

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

    本文发布于:2023-10-27 04:27:38,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1532313.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:映像   文件   Docker

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!