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

Proxmox虚拟机中Docker容器网络功能缺失求助

Docker容器无网络功能:无法解析域名、缺少基础网络命令(Proxmox宿主机上的Ubuntu 18.04)

我现在遇到一个棘手的Docker网络问题,已经折腾两天了,恳请大家帮忙看看!

环境信息:

  • 宿主机运行在Proxmox Virtual Environment 5.3-9上,系统是Ubuntu 18.04.2 LTS(bionic),具体信息:
    Distributor ID: Ubuntu
    Description: Ubuntu 18.04.2 LTS
    Release: 18.04
    Codename: bionic
    
  • Docker版本:Docker version 18.09.7, build 2d0083d

已配置的网络相关内容:

  1. docker0网桥状态:
    bridge name	bridge id		STP enabled	interfaces
    docker0		8000.02426bdb101b			no		
    
  2. iptables NAT表规则(执行iptables -t nat -L的输出):
    Chain PREROUTING (policy ACCEPT)
    target     prot opt source               destination         
    DOCKER     all  --  anywhere             anywhere             ADDRTYPE match dst-type LOCAL
    
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination          
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination         
    DOCKER     all  --  anywhere            !localhost/8          ADDRTYPE match dst-type LOCAL
    
    Chain POSTROUTING (policy ACCEPT)
    target     prot opt source               destination         
    MASQUERADE  all  --  172.17.0.0/16        anywhere            
    
    Chain DOCKER (2 references)
    target     prot opt source               destination         
    RETURN     all  --  anywhere             anywhere            
    
  3. 我试过Stack Overflow上的一种常见配置方法来排查,但问题依然存在。

具体问题:

我可以通过docker run -it ubuntu bash正常启动容器并进入shell,但容器完全没有网络功能:

  • 容器内缺少基础网络命令:ip、route、ping、ifconfig都找不到
  • 执行apt update时超时,报错域名解析失败,输出如下:
    apt update
    Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
      Temporary failure resolving 'security.ubuntu.com'
    Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease
      Temporary failure resolving 'archive.ubuntu.com'
    
  • 检查容器内的/etc/resolv.conf,内容看起来是正常的:
    nameserver 172.16.40.1
    nameserver 8.8.8.8
    search localdomain
    

对比测试:

我在Linux Mint上用完全相同的步骤安装Docker,容器的apt功能是正常的,没有出现这些问题。

实在找不到原因了,麻烦大家帮忙分析一下可能的问题点!

内容的提问来源于stack exchange,提问作者Pavel Niedoba

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.14 06:30:32