AlmirKadric-Published / docker-tuntap-osx

A tuntap shim installer for "Docker for Mac"
MIT License
332 stars 65 forks source link

Runned both scripts, still unable to access the container through IP #17

Closed Heucles closed 6 years ago

Heucles commented 6 years ago

Hi @AlmirKadric, first of all, thank you for the work that you've put into this project. But I am facing some issues, and I'm wondering if you could help me with them.

I am on a MacBook Pro with HighSierra(10.13.3) on it, and after installing tuntap, and running both scripts successfully, I am still unable to access my container through the ip that is provided for me over the docker inspect command.

Also there it go my docker info: Docker version 17.12.0-ce, build c97c6d6

I was expecting that after running both of the scripts I would be able to access the container directly using the IP (provided on docker inspect) from a terminal running on the host.

Have I missed something regarding the setup or the use of it?

Also I think it is worth mentioning that I am able to ping the IP 10.0.75.2 after running the scripts.

Let me know if there is any more info that I should provide for you.

Thank you in advance, best

Heucles

AlmirKadric commented 6 years ago

hi @Heucles, have you read the README.md file and followed the instructions there?

The scripts will install a shim which attaches a tap interface to the docker Host VM and bring up the 10.0.75.(1,2) ip bridge. However you still need to setup the IP routing into your containers. This is what the README.md file explains.

Alternatively if you are using Node.js you can use my other project which automates this process as well for you (https://github.com/AlmirKadric-Published/helpers-docker-nodejs)

Let me know if you're still having issues

nifr commented 6 years ago

You need to route all traffic to docker's IP addresses through the tuntap interface like this:

sudo route add -net 172.16.0.0 -netmask 255.240.0.0 10.0.75.2

Needs to be done after every host restart obviously.

For some reason I occasionally need to remove the routing and add it back again if I can't connect to the containers anymore.

sudo route delete -net 172.16.0.0 -netmask 255.240.0.0 10.0.75.2
sudo route add -net 172.16.0.0 -netmask 255.240.0.0 10.0.75.2

Hope that helps :)

AlmirKadric commented 6 years ago

@Heucles are you still having issues? can I consider this issue as resolved?

AlmirKadric commented 6 years ago

This issue was inactive, if there are further issues feel free to re-open the issue.