当前位置:   article > 正文

container的构建镜像失败:snapshotter not loaded: overlayfs: invalid argument_failed to load plugin io.containerd.snapshotter.v1

failed to load plugin io.containerd.snapshotter.v1.devmapper

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

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

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

  1. [root@docker <localhost> /pkg ]#ctr plugin ls
  2. TYPE ID PLATFORMS STATUS
  3. io.containerd.content.v1 content - ok
  4. io.containerd.snapshotter.v1 aufs linux/amd64 skip
  5. io.containerd.snapshotter.v1 btrfs linux/amd64 skip
  6. io.containerd.snapshotter.v1 devmapper linux/amd64 error
  7. io.containerd.snapshotter.v1 native linux/amd64 ok
  8. io.containerd.snapshotter.v1 overlayfs linux/amd64 error
  9. io.containerd.snapshotter.v1 zfs linux/amd64 skip
  10. io.containerd.metadata.v1 bolt - ok
  11. io.containerd.differ.v1 walking linux/amd64 ok

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

  1. ... ...
  2. 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"
  3. ... ...
  4. INFO[2022-01-18T22:02:44.351374971+08:00] Connect containerd service
  5. 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文件系统:

  1. /dev/vda3 on /etc/resolv.conf type xfs (rw,relatime,attr2,inode64,noquota)
  2. /dev/vda3 on /etc/hostname type xfs (rw,relatime,attr2,inode64,noquota)
  3. /dev/vda3 on /etc/hosts type xfs (rw,relatime,attr2,inode64,noquota)
  4. /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

即可解决问题

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/477667
推荐阅读
相关标签
  

闽ICP备14008679号