在启动docker注册表后,不能访问`http://172.17.0.2:5000` [英] Can't visit `http://172.17.0.2:5000` after starting docker registry
本文介绍了在启动docker注册表后,不能访问`http://172.17.0.2:5000`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Mac系统上,我在部署文档:
On a mac system, I start the register following the deploy document:
docker run -d -p 5000:5000 --restart=always --name registry registry:2
其ip为IPAddress:172.17.0.2
,它来自命令 docker inspect< cid>
And its ip is "IPAddress": "172.17.0.2"
, which is from the command docker inspect <cid>
但是我无法telnet其端口:
But I can't telnet its port:
$ telnet 172.17.0.2 5000
Trying 172.17.0.2...
telnet: connect to address 172.17.0.2: Can't assign requested address
telnet: Unable to connect to remote host
或
$ curl http://172.17.0.2:5000
curl: (7) Couldn't connect to server
我ssh到容器检查:
$ docker exec -it cda bash
root@cda4c64efd06:/# netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp6 0 0 :::5000 :::* LISTEN
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
root@cda4c64efd06:/# curl -I http://localhost:5000
HTTP/1.1 200 OK
Cache-Control: no-cache
Date: Fri, 11 Dec 2015 07:34:17 GMT
Content-Type: text/plain; charset=utf-8
root@cda4c64efd06:/#
它的绑定 tcp6
通常不会 tcp
。
哪里错了?
推荐答案
如果您使用docker-机器,请参阅在docker机器中的端口转发
If you are using docker-machine, see "Port forwarding in docker-machine?"
-
任何一个端口转发VirtualBox级别上的5000端口(意思是
localhost:5000
将工作)
VBoxManage controlvm "boot2docker-vm" natpf1 "tcp-port5000,tcp,,5000,,5000";
或使用由 $返回的ip(docker-machine ip < yourMachine>)
这篇关于在启动docker注册表后,不能访问`http://172.17.0.2:5000`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文