运行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.
为在这里描述.