我在 docker 容器中托管我的 owncloud 实例。我熟悉 docker 技术和可能性,但实际“操作”对我来说很新。目前我不确定我的主机设备是否像我预期的那样授予网络访问权限/速度(docker 容器使用桥接千兆位接口br0)。
主机设备信息和配置
我的主机设备支持千兆位:
tharmar@nuc:~$ dmesg |grep em1
[ 2.249914] e1000e 0000:00:19.0 em1: renamed from eth0
[ 2.262696] systemd-udevd[125]: renamed network interface eth0 to em1
[ 5.290467] device em1 entered promiscuous mode
[ 8.430199] e1000e: em1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
[ 8.430231] br0: port 1(em1) entered forwarding state
[ 8.430240] br0: port 1(em1) entered forwarding state
[ 17.434250] br0: port 1(em1) entered forwarding state
我手动将主机 /etc/network/interfaces 更改为以下配置:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#auto em1
#iface em1 inet dhcp
auto br0
iface br0 inet dhcp
bridge_ports em1
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
我根据网上找到的教程(手头没有链接)调整了 br0 配置。在我的主机上,我达到了以下下载速度:
- 互联网 = 5,64MB/s
- 内部网络 = 88.0MB/s
Docker 容器信息
- 图片:l3iggs/owncloud
- 运行命令:
docker run --restart=always -v /media/500GB/owncloud/config:/usr/share/webapps/owncloud/config -v /media/500GB/owncloud/data:/usr/share/webapps/owncloud/data --name oc -p 80:80 -p 443:443 -d l3iggs/owncloud
docker 网络
tharmar@nuc:~$ docker network ls
NETWORK ID NAME DRIVER
c5444bf94367 bridge bridge
544630efd75a none null
ab858df7af57 host host
docker network inspect bridge(我在这个网络中找到了我的容器)
{
"Name": "bridge",
"Id": "c5444bf94367cf747e0c05dc967587c608ae8401fa1fccf65233fd4334b91a43",
"Scope": "local",
"Driver": "bridge",
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16"
}
]
},
"Containers": {
"665f87dbf4f48d1ee96e71df592923323a91702b7bd0845ca59e0de6d068ce30": {
"Name": "oc",
"EndpointID": "7853f7630e4e1f64cd6241e1edb550906240e5acdb5cb158fe6cd5bd926171ab",
"MacAddress": "02:42:ac:11:00:03",
"IPv4Address": "172.17.0.3/16",
"IPv6Address": ""
}
}
},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
}
}
有人能告诉我瓶颈在哪里吗?我配置错了吗,还是根本没有配置?
如果您确实需要更多有关我的环境的信息,请随时询问,我会尽快更新问题。