nerdctl启动容器报错

问题描述

使用nerdctl启动容器提示如下错误:

$ nerdctl run -d -p 8080:80 --name nginx nginx:alpine
FATA[0010] needs CNI plugin &{"bridge" "nerdctl0" %!q(bool=true) %!q(bool=false) %!q(bool=false) %!q(bool=true) '\x00' %!q(bool=true) %!q(bool=false) '\x00' map["ranges":[[map["gateway":"10.4.0.1" "subnet":"10.4.0.0/24"]]] "routes":[map["dst":"0.0.0.0/0"]] "type":"host-local"]} to be installed in CNI_PATH ("/opt/cni/bin"), see https://github.com/containernetworking/plugins/releases: exec: "/opt/cni/bin/bridge": stat /opt/cni/bin/bridge: no such file or directory 
问题分析

根据提示需要安装CNI插件,容器启动依赖网络组件。

问题解决

1.下载cni-plugin

$ wget https://github.com/containernetworking/plugins/releases/download/v1.1.1/cni-plugins-linux-amd64-v1.1.1.tgz

2.安装cni-plugin

$ mkdir -p /opt/cni/bin
$ tar xf cni-plugins-linux-amd64-v1.1.1.tgz -C /opt/cni/bin/
$ ls -l /opt/cni/bin/
total 63728
-rwxr-xr-x 1 root root 3780654 Mar 10 01:08 bandwidth
-rwxr-xr-x 1 root root 4221977 Mar 10 01:08 bridge
-rwxr-xr-x 1 root root 9742834 Mar 10 01:08 dhcp
-rwxr-xr-x 1 root root 4345726 Mar 10 01:08 firewall
-rwxr-xr-x 1 root root 3811793 Mar 10 01:08 host-device
-rwxr-xr-x 1 root root 3241605 Mar 10 01:08 host-local
-rwxr-xr-x 1 root root 3922560 Mar 10 01:08 ipvlan
-rwxr-xr-x 1 root root 3295519 Mar 10 01:08 loopback
-rwxr-xr-x 1 root root 3959868 Mar 10 01:08 macvlan
-rwxr-xr-x 1 root root 3679140 Mar 10 01:08 portmap
-rwxr-xr-x 1 root root 4092460 Mar 10 01:08 ptp
-rwxr-xr-x 1 root root 3484284 Mar 10 01:08 sbr
-rwxr-xr-x 1 root root 2818627 Mar 10 01:08 static
-rwxr-xr-x 1 root root 3379564 Mar 10 01:08 tuning
-rwxr-xr-x 1 root root 3920827 Mar 10 01:08 vlan
-rwxr-xr-x 1 root root 3523475 Mar 10 01:08 vrf

3.启动容器

$ nerdctl run -d -p 8080:80 --name nginx nginx:alpine
7213119990c436213fa16dab62911fc4440099f5eed5b23bbf641a0c165edb8c
参考链接

[1] https://github.com/containerd/nerdctl#install [2] https://github.com/containernetworking/plugins 如果您有其他问题,欢迎您联系火山引擎技术支持服务

0
0
0
0
评论
未登录
暂无评论