container的构建镜像失败:snapshotter not loaded: overlayfs: invalid argument

使用nerdctl套件构建镜像,遇见了报错:

[root@docker <localhost> /image_root ]#nerdctl build  -f Dockerfile  .
[+] Building 3.3s (6/6) FINISHED                                                              
 => [internal] load build definition from Dockerfile                                     0.0s
 => => transferring dockerfile: 238B                                                     0.0s
 => [internal] load .dockerignore                                                        0.0s
 => => transferring context: 2B                                                          0.0s
 => [internal] load build context                                                        0.3s
 => => transferring context: 287.88kB                                                    0.3s
 => [1/2] WORKDIR /home/build/image_root/                                                0 .0s
 => CACHED [2/2] COPY build_root/ .                                                        0.0s
 => exporting to oci image format                                                        2.8s
 => => exporting layers                                                                  0.0s
 => => exporting manifest sha256:3f2ec...                                                0.0s
 => => exporting config sha256:a4901...                                                  0.0s
 => => sending tarball                                                                   2.7s
unpacking overlayfs@sha256:3f2ec... (sha256:3f2ec...)...FATA[0004] failed to stat snapshot sha256:ac2706: snapshotter not loaded: overlayfs: invalid argument 

 查看containerd组件加载情况,发现overlayfs异常

[root@docker <localhost> /pkg ]#ctr plugin ls
TYPE                            ID                       PLATFORMS      STATUS    
io.containerd.content.v1        content                  -              ok        
io.containerd.snapshotter.v1    aufs                     linux/amd64    skip      
io.containerd.snapshotter.v1    btrfs                    linux/amd64    skip      
io.containerd.snapshotter.v1    devmapper                linux/amd64    error     
io.containerd.snapshotter.v1    native                   linux/amd64    ok        
io.containerd.snapshotter.v1    overlayfs                linux/amd64    error     
io.containerd.snapshotter.v1    zfs                      linux/amd64    skip      
io.containerd.metadata.v1       bolt                     -              ok        
io.containerd.differ.v1         walking                  linux/amd64    ok        

在查看containerd运行日志,存在报错:

... ...
WARN[2022-01-18T22:02:44.263567300+08:00] could not use snapshotter overlayfs in metadata plugin  error="/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs does not support d_type. If the backing filesystem is xfs, please reformat with ftype=1 to enable d_type support"

... ...

INFO[2022-01-18T22:02:44.351374971+08:00] Connect containerd service                   
WARN[2022-01-18T22:02:44.351487012+08:00] failed to load plugin io.containerd.grpc.v1.cri  error="failed to create CRI service: failed to find snapshotter \"overlayfs\""

查看容器内的文件系统,确认为xfs文件系统:

/dev/vda3 on /etc/resolv.conf type xfs (rw,relatime,attr2,inode64,noquota)
/dev/vda3 on /etc/hostname type xfs (rw,relatime,attr2,inode64,noquota)
/dev/vda3 on /etc/hosts type xfs (rw,relatime,attr2,inode64,noquota)
/dev/vda3 on /home/jenkins/xxxxxxxxxxxxx type xfs (rw,relatime,attr2,inode64,noquota)

再综合docker官方文档对xfs的要求描述:

Use the OverlayFS storage driver | Docker Documentation

对于xfs文件系统,需要在设置 d_type=true

即可解决问题

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值