You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

树莓派4运行Ubuntu Server 21.10时Docker创建容器端点失败求助

这个问题看起来是Docker在创建bridge网络的veth接口对时遇到了内核层面的支持问题,结合你用的树莓派4(ARM64架构)+ Ubuntu Server 21.10的环境,我整理了几个针对性的排查和解决步骤,你可以逐一尝试:

1. 检查并加载veth内核模块

veth是Docker创建容器网络的核心模块,如果内核没加载这个模块就会出现这类错误。

  • 先检查模块是否已加载:
    lsmod | grep veth
    
  • 如果没有输出,手动加载模块:
    sudo modprobe veth
    
  • 为了确保开机自动加载,编辑/etc/modules文件,在末尾添加一行veth,保存后重启系统。

2. 尝试用host网络模式测试

先排除bridge网络的问题,用host模式运行hello-world:

docker run --network host hello-world

如果这个命令能成功运行,说明问题确实出在Docker的bridge网络配置上,继续往下走。

3. 重置Docker的网络配置

Docker的网络配置文件可能损坏,重置一下:

  • 停止Docker服务:
    sudo systemctl stop docker
    
  • 删除Docker的网络存储目录:
    sudo rm -rf /var/lib/docker/network/
    
  • 重启Docker服务:
    sudo systemctl start docker
    
  • 再次尝试运行hello-world镜像。

4. 升级系统内核

Ubuntu Server 21.10的默认内核可能在ARM64架构上有兼容性问题,升级到最新的HWE内核试试:

sudo apt update && sudo apt install linux-generic-hwe-21.10

安装完成后重启系统,再测试Docker。

5. 安装Docker官方版本(而非Ubuntu仓库版本)

你之前用的是Ubuntu仓库的Docker包(0ubuntu5后缀),可能存在适配问题,换成官方维护的版本:

  • 先卸载现有Docker:
    sudo apt-get remove docker docker-engine docker.io containerd runc
    
  • 添加Docker官方源并安装:
    sudo apt-get update
    sudo apt-get install ca-certificates curl gnupg lsb-release
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    sudo apt-get update
    sudo apt-get install docker-ce docker-ce-cli containerd.io
    
  • 安装完成后重启Docker,测试hello-world。

6. 检查并调整containerd配置

containerd是Docker的底层容器运行时,配置错误也可能导致网络问题:

  • 编辑containerd的配置文件(如果不存在就创建):
    sudo nano /etc/containerd/config.toml
    
  • 添加或确保以下配置存在:
    [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
      runtime_type = "io.containerd.runc.v2"
    [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
      SystemdCgroup = true
    
  • 保存后重启containerd和Docker:
    sudo systemctl restart containerd
    sudo systemctl restart docker
    
  • 再次测试镜像运行。

如果以上步骤都没解决,可以检查系统的dmesg日志(dmesg | grep -i veth),看看有没有更详细的内核报错信息,这有助于进一步定位问题。

内容的提问来源于stack exchange,提问作者Krystian Kan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 21:12:42