背景:执行 nerdctl run -d --name nginx -p8080:80 nginx 时,报如下错误
FATA[0000] failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: time="2023-12-08T15:15:51+08:00" level=fatal msg="failed to call cni.Setup: plugin type=\"bridge\" failed (add): incompatible CNI versions; config is \"1.0.0\", plugin supports [\"0.1.0\" \"0.2.0\" \"0.3.0\" \"0.3.1\" \"0.4.0\"]"
Failed to write to log, write /var/lib/nerdctl/1935db59/containers/k8s.io/9e9c91a28fe6bf03d3c9c7e66701bdbadf718ddc11af094176983e3d292bf819/oci-hook.createRuntime.log: file already closed: unknown
1、分析原因:由于nerdctl 运行容器时,遇到了与 CNI(容器网络接口)插件版本不兼容的问题
2、解决方法:
查看/etc/cni/net.d/10-calico.conflist CNI 的版本号"cniVersion": "0.4.0",
修改CNI bridge 配置的版本号
cat /etc/cni/net.d/nerdctl-bridge.conflist
"cniVersion": "1.0.0", 改为0.4.0 即可
注:集群内nerdctl run 只能使用 容器ip+端口访问服务默认使用bridge网络模式的话,想要外部访问的话需要指定host 网络模式【host模式不用修改CNI version 版本】如下
nerdctl run -d --name nginx --network host -p80:80 nginx 验证
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 因为Apifox不支持离线,我果断选择了Apipost!
· 通过 API 将Deepseek响应流式内容输出到前端
2022-12-08 ceph 集群 健康状态报 clock skew detected on mon.tg-ceph-mon-2