V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
xsir
V2EX  ›  Docker

求救! docker 容器内无法访问外网的问题

  •  
  •   xsir · 2019-11-07 19:28:00 +08:00 · 7438 次点击
    这是一个创建于 1603 天前的主题,其中的信息可能已经有所发展或是发生改变。
    如题,google 了一圈,发现提出问题的还不少,没有一个方案可以解决的...
    有没有老铁解决过这个问题? 求帮助,卡住一天了....
    第 1 条附言  ·  2019-11-08 08:38:20 +08:00

    系统是 ubuntu 16.04
    docker info

    Containers: 11
     Running: 9
     Paused: 0
     Stopped: 2
    Images: 20
    Server Version: 18.09.7
    Storage Driver: overlay2
     Backing Filesystem: extfs
     Supports d_type: true
     Native Overlay Diff: true
    Logging Driver: json-file
    Cgroup Driver: cgroupfs
    Plugins:
     Volume: local
     Network: bridge host macvlan null overlay
     Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
    Swarm: inactive
    Runtimes: runc
    Default Runtime: runc
    Init Binary: docker-init
    containerd version: 
    runc version: N/A
    init version: v0.18.0 (expected: fec3683b971d9c3ef73f284f176672c44b448662)
    Security Options:
     apparmor
     seccomp
      Profile: default
    Kernel Version: 4.4.0-142-generic
    Operating System: Ubuntu 16.04.6 LTS
    OSType: linux
    Architecture: x86_64
    CPUs: 1
    Total Memory: 1.953GiB
    Name: TP-ub16
    Docker Root Dir: /var/lib/docker
    Debug Mode (client): false
    Debug Mode (server): false
    Registry: https://index.docker.io/v1/
    Labels:
    Experimental: false
    Insecure Registries:
     127.0.0.0/8
    Live Restore Enabled: false
    
    WARNING: No swap limit support
    
    10 条回复    2019-11-09 16:25:34 +08:00
    silenceshell
        1
    silenceshell  
       2019-11-07 20:10:55 +08:00
    docker run --network host
    rrfeng
        2
    rrfeng  
       2019-11-07 20:16:32 +08:00 via Android
    完了我家不能上网了,Google 了一圈好多问的就是没有回答怎么把我家网修好的!
    Herobs
        3
    Herobs  
       2019-11-07 20:18:30 +08:00 via Android
    检查 ip_forward 打开没,docker info 下面有警告
    mritd
        4
    mritd  
       2019-11-08 07:19:19 +08:00 via iPhone
    没有代码,你说个鸡儿
    mritd
        5
    mritd  
       2019-11-08 07:20:03 +08:00 via iPhone
    我们线上有个 bug,有人知道是怎么造成的么
    xsir
        6
    xsir  
    OP
       2019-11-08 08:33:20 +08:00
    @silenceshell 这样是可以的, 但是不知道原因啊,怎么彻底解决呢...
    xsir
        7
    xsir  
    OP
       2019-11-08 08:33:39 +08:00
    @rrfeng 老哥你在说啥,宿主机是可以上网的
    xsir
        8
    xsir  
    OP
       2019-11-08 08:35:01 +08:00
    @Herobs ip_forward 是打开的
    Herobs
        9
    Herobs  
       2019-11-08 09:55:36 +08:00 via Android
    容器的信息也贴出来啊,里面有个 SandboxKey,配合 nsenter 很容易找出问题
    ccagml
        10
    ccagml  
       2019-11-09 16:25:34 +08:00 via Android
    Docker 的四种网络模式,这个嘛
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1204 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 23:15 · PVG 07:15 · LAX 16:15 · JFK 19:15
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.