Ubuntu 16.04上安装Docker后互联网丢失

Ubuntu 16.04上安装Docker后互联网丢失

我已经在 Ubuntu 16.04 中安装了 docker-ce,使用安装指南官方网站上给出了。安装 Docker 后,主机无法再连接到互联网。为了获得正确的互联网连接,我必须删除docker-ce并重新启动。

这个问题可能看起来类似于,但是那篇文章中介绍的方法却不起作用。

我尝试了几件事:

  1. 我可以 ping 8.8.8.8,但不能 ping www.google.com。
  2. dns=dnsmasq我尝试通过注释掉中的行来关闭网络管理器\etc\NetworkManager\NetworkManager.conf。但是没有用。
  3. 我尝试将8.8.8.8其设为 中的第一个名称服务器\etc\resolv.conf。这可行,但重启后会丢失,如文件中所述。
  4. 为了使上述更改永久生效,我使用了几种方法,例如添加nameserver 8.8.8.8head文件下\etc\resolvconf\resolv.conf.d和添加server=8.8.8.8\etc\dnsmasq.conf。这些方法,从这里,互联网连接时断时续,速度非常慢。此连接不断中断。

默认名称服务器为etc\resolv.conf127.0.0.1。安装\删除 Docker 时此名称服务器不会更改。

当前环境

parth@parth-Inspiron-5565:/etc$ sudo docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 18.09.3
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: e6b3f5632f50dbc4e9cb6288d911bf4f5e95b18e
runc version: 6635b4f0c6af3810594d2770f662f34ddc15b40d
init version: fec3683
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.15.0-46-generic
Operating System: Ubuntu 16.04.6 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.13GiB
Name: parth-Inspiron-5565
ID: R4FN:KR6P:OGYS:SV3X:K7FB:2OPX:YGOU:A5OY:LZ3O:QEQQ:EBRS:TY5F
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
Product License: Community Engine

WARNING: No swap limit support

Docker 服务状态

parth@parth-Inspiron-5565:/etc$ sudo service docker status
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2019-03-20 15:12:09 IST; 5min ago
     Docs: https://docs.docker.com
 Main PID: 4803 (dockerd)
    Tasks: 13
   Memory: 31.3M
      CPU: 754ms
   CGroup: /system.slice/docker.service
           └─4803 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Mar 20 15:12:07 parth-Inspiron-5565 dockerd[4803]: time="2019-03-20T15:12:07.811072977+05:30" level=warning msg="Your kernel does not support swap memory limit"
Mar 20 15:12:07 parth-Inspiron-5565 dockerd[4803]: time="2019-03-20T15:12:07.811201504+05:30" level=warning msg="Your kernel does not support cgroup rt period"
Mar 20 15:12:07 parth-Inspiron-5565 dockerd[4803]: time="2019-03-20T15:12:07.811233936+05:30" level=warning msg="Your kernel does not support cgroup rt runtime"
Mar 20 15:12:07 parth-Inspiron-5565 dockerd[4803]: time="2019-03-20T15:12:07.812451552+05:30" level=info msg="Loading containers: start."
Mar 20 15:12:08 parth-Inspiron-5565 dockerd[4803]: time="2019-03-20T15:12:08.754820327+05:30" level=info msg="Default bridge (docker0) is assigned with an IP address 172.31.0.0/16. Daemon option --bip can
Mar 20 15:12:08 parth-Inspiron-5565 dockerd[4803]: time="2019-03-20T15:12:08.945255414+05:30" level=info msg="Loading containers: done."
Mar 20 15:12:09 parth-Inspiron-5565 dockerd[4803]: time="2019-03-20T15:12:09.316910702+05:30" level=info msg="Docker daemon" commit=774a1f4 graphdriver(s)=overlay2 version=18.09.3
Mar 20 15:12:09 parth-Inspiron-5565 dockerd[4803]: time="2019-03-20T15:12:09.317457771+05:30" level=info msg="Daemon has completed initialization"
Mar 20 15:12:09 parth-Inspiron-5565 dockerd[4803]: time="2019-03-20T15:12:09.649782655+05:30" level=info msg="API listen on /var/run/docker.sock"
Mar 20 15:12:09 parth-Inspiron-5565 systemd[1]: Started Docker Application Container Engine.

是否配置

parth@parth-Inspiron-5565:~$ ifconfig
br-c3e01d026d40 Link encap:Ethernet  HWaddr 02:42:84:ad:16:49  
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

docker0   Link encap:Ethernet  HWaddr 02:42:c4:54:a7:3a  
          inet addr:172.31.0.1  Bcast:172.31.255.255  Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

enp1s0    Link encap:Ethernet  HWaddr 28:f1:0e:4a:77:f2  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:9142 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9142 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1539138 (1.5 MB)  TX bytes:1539138 (1.5 MB)

wlp2s0    Link encap:Ethernet  HWaddr 94:53:30:48:08:e3  
          inet addr:192.168.0.109  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::24c0:73d4:1184:f7ff/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:66481 errors:0 dropped:0 overruns:0 frame:0
          TX packets:34205 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:66056535 (66.0 MB)  TX bytes:5806026 (5.8 MB)

网络管理器接口信息

parth@parth-Inspiron-5565:~$ sudo nmcli dev show | grep -E 'IP4|DEVICE'
GENERAL.DEVICE:                         br-c3e01d026d40
IP4.ADDRESS[1]:                         192.168.0.1/24
IP4.GATEWAY:                            
GENERAL.DEVICE:                         docker0
IP4.ADDRESS[1]:                         172.31.0.1/16
IP4.GATEWAY:                            
GENERAL.DEVICE:                         wlp2s0
IP4.ADDRESS[1]:                         192.168.0.109/24
IP4.GATEWAY:                            192.168.0.1
IP4.ROUTE[1]:                           dst = 169.254.0.0/16, nh = 0.0.0.0, mt = 1000
IP4.DNS[1]:                             192.168.0.1
GENERAL.DEVICE:                         enp1s0
GENERAL.DEVICE:                         lo
IP4.ADDRESS[1]:                         127.0.0.1/8

brctl 输出

parth@parth-Inspiron-5565:~$ brctl show
bridge name bridge id       STP enabled interfaces
br-c3e01d026d40     8000.024273663b1c   no      
docker0     8000.0242e83f65e7   no  

笔记本电脑配置

parth@parth-Inspiron-5565:/etc$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.6 LTS"
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

parth@parth-Inspiron-5565:/etc$ uname -a
Linux parth-Inspiron-5565 4.15.0-46-generic #49~16.04.1-Ubuntu SMP Tue Feb 12 17:45:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

相关内容