我试图练习链接https://docs.docker.com/engine/userguide/networking/work-with-networks/#connect-containers中提供的示例。
docker network create -o "com.docker.network.bridge.host_binding_ipv4"="172.23.0.1" my-network
$ docker network inspect my-network
[
{
"Name": "my-network",
"Id": "90158e0c6f03a62f4852fcaa429f8a4d0df0e3c27f908500337e69b42d78c3a5",
"Created": "2017-09-15T20:14:50.778210676Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "172.23.0.0/16",
"Gateway": "172.23.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {
"com.docker.network.bridge.host_binding_ipv4": "172.23.0.1"
},
"Labels": {}
}
]
然后在这个网络上运行redis的下一个docker命令给了我错误。
$docker run -d -P --name redis --network my-network redis
8a91f4a6e6a688173060ac20d71b461e13a7c7b7d6cbf1318d66114922e47357 docker:来自守护程序的错误响应:驱动程序在端点redis上编程外部连接失败(4e8fad58239e5785f31c0c4e18a276f334410bcec3f9ecb6ec850d75e6120250):启动userland代理时出错:listen tcp 172.23.0.1:32787:bind:无法分配请求的地址。
如何解决此错误?
答案 0 :(得分:0)
为避免头痛,请重新启动docker一次并再次测试