Search code examples
dockerboot2dockerdocker-machine

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. Long story short, I need to be able to curl 172.17.0.1:8500.

That works just fine from within the Virtual Machine but fails from within MacOS.

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

What should I do to go around this issue?


Solution

  • Krisztian Horvath from sequenceiq/docker-ambari was kind enough to help me out with that.

    So, what you need to do is to

    docker-machine ip default
    

    to get VM_IP your virtual machine IP and then

    sudo route add -net 172.17.0.0/16 VM_IP