运行Docker容器时主机上无网络 [英] No network on host machine when running a Docker container

查看:848
本文介绍了运行Docker容器时主机上无网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Arch Linux计算机上,使用以下命令运行容器时主机上没有网络:

I'm on Arch Linux machine, and have no network on the host when running a container with this command:

docker run jenkins

停止Docker之后,网络又恢复了. 任何建议都非常受欢迎.

After stopping the Docker the network is back again. Any suggestions are more than welcome.

似乎在使用-p选项运行并提供80以外的其他端口时,网络可用了几分钟,然后又丢失了.

It seems that when running with -p option and providing some other port than 80, the network is available for a few minutes, and then it gets lost again.

**> docker version**

Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.5.1
 Git commit:   a34a1d5-dirty
 Built:        Sun Nov 22 00:15:15 UTC 2015
 OS/Arch:      linux/amd64

Server:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.5.1
 Git commit:   a34a1d5-dirty
 Built:        Sun Nov 22 00:15:15 UTC 2015
 OS/Arch:      linux/amd64

**> docker info**

Containers: 31
Images: 57
Server Version: 1.9.1
Storage Driver: devicemapper
 Pool Name: docker-8:5-548039-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 107.4 GB
 Backing Filesystem: 
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 3.584 GB
 Data Space Total: 107.4 GB
 Data Space Available: 7.741 GB
 Metadata Space Used: 7.496 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.14 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.113 (2015-12-05)
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.2.5-1-ARCH
Operating System: Arch Linux (containerized)
CPUs: 4
Total Memory: 7.709 GiB
Name: arch
ID: OF5Y:H7O4:M4R6:GCF6:NSEU:LNG6:K7NV:FJDM:DUVI:6KOM:LTRB:EUPP

> iptables -L

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
DOCKER     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain DOCKER (1 references)
target     prot opt source               destination         

推荐答案

解决方案是使用以下命令创建或编辑/etc/connman/main.conf:

The solution is to create or edit /etc/connman/main.conf with the following:

[General]
NetworkInterfaceBlacklist=vmnet,vboxnet,virbr,ifb,docker,veth,eth,wlan

然后重新启动connman.

And restart connman.

在这里描述.

这篇关于运行Docker容器时主机上无网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆