问题描述
我的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
在。如何进一步调试问题?
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上找到讨论; 。
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; https://github.com/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
也可以解决该问题;
- 使用
ftype = 1
- 使用其他存储驱动程序。请注意,不建议将默认设备映射器配置(使用环回设备)用于生产,因此需要手动配置。
-compatibility(较旧版本的docker允许在没有 d_type
的系统上运行叠加),docker 1.13只会在守护程序日志中记录 warning (),但不会在以后的版本中不再受支持。
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 (https://github.com/docker/docker/pull/27433), but will no longer be supported in a future version.
这篇关于Docker在构建映像时无法删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!