简体   繁体   English

如何通过主机MacOS计算机连接到在Docker容器上运行的服务?

[英]How to connect to a service running on docker container from withing host MacOS machine?

I am trying to install Hadoop on Docker on top of docker-machine. 我正在尝试在docker-machine上的Docker上安装Hadoop。 Long story short, I need to be able to curl 172.17.0.1:8500 . 长话短说,我需要能够curl 172.17.0.1:8500

That works just fine from within the Virtual Machine but fails from within MacOS. 在虚拟机中可以正常运行,但在MacOS内则无法运行。

curl: (7) Failed connect to 172.17.0.1:8500; Operation timed out

What should I do to go around this issue? 我应该怎么做才能解决这个问题?

Krisztian Horvath from sequenceiq/docker-ambari was kind enough to help me out with that. 来自sequenceiq/docker-ambari Krisztian Horvath足够帮助我。

So, what you need to do is to 因此,您需要做的是

docker-machine ip default

to get VM_IP your virtual machine IP and then 获取VM_IP您的虚拟机IP,然后

sudo route add -net 172.17.0.0/16 VM_IP

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从Docker容器内部连接到主机中的服务? - How to connect to service in the host machine from inside a docker container? 从 docker 容器连接主机上运行的服务 - connect with service running on host from docker container 如何从 Spring 引导 docker 容器在同一台机器上运行访问 RabbitMQ 服务(在主机上) - How to access RabbitMQ service (on host machine) from Spring boot docker container running on same machine 如何在Docker机器中将JMX从主机连接到Docker容器? - How to connect with JMX from host to Docker container in Docker machine? 使用 --network=host 在 MacOS 上运行 docker 容器时如何访问主机上的端口? - How to access a port on the host machine when running docker container on MacOS with --network=host? 从主机连接到docker容器中的postgres - Connect to postgres in docker container from host machine 如何从主机(Windows 机器)连接到 docker 容器 - How to connect to a docker container from host(windows machine) 如何从主机连接到Docker Postgres容器 - How to Connect to Docker Postgres Container from Host Machine docker(Mac / Windows):如何从容器访问主机服务? - docker(Mac/Windows): how to access host machine service from the container? 如何从主机访问在 docker 容器中运行的 mysql? - How to access mysql running in docker container from host machine?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM