环境:CentOS Linux release 7.1.1503 (Core)
dockerfiles 中有1
2
3RUN mv /app/docker/localtime /etc/localtime
......
RUM rm /app/docker
docker build 过程中发现报错1
2mv: can't rename '/app/docker/localtime': Invalid argument
The command '/bin/sh -c mv /app/docker/localtime /etc/localtime' returned a non-zero code: 1
而同样的脚本在另外一个Ubuntu系统下没有这样的报错
从 docker info中可以看到
Centos7
Ubuntu16.04
并且可以看到报错信息1
2
3WARNING: overlay: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior.
Reformat the filesystem with ftype=1 to enable d_type support.
Running without d_type support will not be supported in future releases.
Centos7 发行版默认的Kernel版本是3.10,但是Overlay2存储驱动需要4.0以上的kernel版本支持,所以默认使用overlay 并且不支持d_type, 才导致这个报错。
具体
解决方法一:
格式化 XFS 系统,添加ftype=1
1 | # 查看当前系统xfs |
解决方法二:
修改 storage driver 为 devicemapper1
2
3
4
5
6vim /etc/docker/daemon.json
增加
{
...
"storage-driver": "devicemapper"
}