Boot2Docker:通过LAN连接到容器 [英] Boot2Docker: Connect to container over LAN
问题描述
http://192.168.59.103:8080
,所以我使用docker主机的ip地址。这对我的本地网络中的其他机器无效,但使用我的mac的ip地址也不起作用。我确定有一些解决这个问题的解决方案,但我找不到任何。这不是那么难吗?我想要的是从本地网络中的另一个主机请求 http:// [IP-Address-of-mac]:8080
。我想我必须在本地机器上设置一些路由规则?有人可以告诉我该怎么办?感谢提前。 最好的问候
Sascha
您需要从OSX框转发到虚拟机
VBoxManage modifyvmboot2docker -vm--natpf1tcp-port8080,tcp ,, 8080,,8080;
应该做的技巧
或者,您可以使用基于ssh的端口转发:
boot2docker ssh -L 8000:localhost: 8000
请参阅 https://github.com/boot2docker/boot2docker/blob/master/doc/WORKAROUNDS.md
I'm using Boot2Docker 1.3.0 on my Mac and I'm pretty happy so far using it. But now I'd like to connect to a http container (exposes port 8080) not from my local machine but from another machine in my local network? If I'm doing it locally I just use http://192.168.59.103:8080
so I'm using the ip address of the docker host. This can't work for other machines in my local network but using the ip address of my mac does not work either. I'm pretty sure there are some solutions for this problem but I can't find any. It can't be that hard right? What I want is to make a request to http://[IP-Address-of-mac]:8080
from another host in my local network. I think I have to set up some routing rules on my local machine right? May anybody tell me what to do? Thanks in advance.
Best regards
Sascha
You need to port forward from the OSX box to the virtual machine
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port8080,tcp,,8080,,8080";
should do the trick
or, you could use ssh based port forwarding:
boot2docker ssh -L 8000:localhost:8000
see https://github.com/boot2docker/boot2docker/blob/master/doc/WORKAROUNDS.md
这篇关于Boot2Docker:通过LAN连接到容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!