Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto DNS on Windows #101

Closed
AgarvaiN opened this issue Jul 23, 2017 · 7 comments
Closed

Auto DNS on Windows #101

AgarvaiN opened this issue Jul 23, 2017 · 7 comments

Comments

@AgarvaiN
Copy link

I'm having issue with Auto DN S(Bind) on Windows Machine

Docker version 17.05.0-ce, build 89658be
docker-compose version 1.13.0, build 1719ceb8
Using Docker Toolbox on Windows

My LOCAL_LISTEN_ADDR=192.168.137.130:
DNS Server are set to 192.168.137.130; 8.8.4.4; 8.8.8.8 In my Network Config

And everything works except for Auto DNS option, which i'd really like, because editing /etc/hosts on Windows is slightly annoying.

When I do edit it, it does propagate properly, so I can confirm everything is working on that side.

But DNS Server is not accessible through 192.168.137.130, I tested it as standalone, and internet becomes inaccessible completely.

Anyways, I saw you are planning on including some Windows related fixes, so you might want to include this as well.

Not sure where exactly does the issue occur, or if I'm not doing something properly(Although I think I covered the most of it), so if anything else is needed, let me know I'll provide further details.

@cytopia
Copy link
Owner

cytopia commented Jul 23, 2017

@AgarvaiN this is an issue related to how Docker Toolbox works. It only works via (afaik) a VirtualBox middle man that provides the actual docker functionality.

The httpd server has an internal IP address (inside the toolbox): 172.16.238.11 to which the DNS server is resolving the TLD_SUFFIX domains to, however this IP address does not seem to be reachable from your host computer, because you would need it to point to 192.168.137.130 (The VirtualBox host). If you changed this value of the DNS server in docker-compose.yml, the the php docker won't be able to issue DNS queries anymore, because it still expects it to go to 172.16.238.11.

Hope this is somehow understandable (a little bit complicated to explain for me).

However, it should work if you use the native Docker for windows: Docker for Windows. Could you give this a try instead of the old Toolbox.

In the mean-time I will think a bit if it can be accomplished with the toolbox via some port-forwarding.

@cytopia
Copy link
Owner

cytopia commented Jul 23, 2017

I might have a workaround:

In docker-compose.yml edit WILDCARD_ADDRESS, DNS_FORWARDER and FORWARD_PORTS_TO_LOCALHOST with the following values:

bind:
  ...
    environment:
      - WILDCARD_ADDRESS=127.0.0.1
      - DNS_FORWARDER=${BIND_DNS_RESOLVER:-8.8.8.8,8.8.4.4}

php:
  ...
    environment:
      - FORWARD_PORTS_TO_LOCALHOST=80:httpd:80,3306:mysql:3306,5432:pgsql:5432,6379:redis:6379,11211:memcd:11211,27017:mongo:27017,5672:rabbit:5672,15672:rabbit:15672

Then the only thing left to do for you is to forward port 80 from 192.168.137.130 to your hosts 127.0.0.1 address

@AgarvaiN
Copy link
Author

AgarvaiN commented Jul 23, 2017

Yeah I understand it's related to Toolbox, but since I need to be able to use VMWare I can't run native Docker because it needs Hyper-V enabled to run. And I'm guessing there might be others out there like me.

That didn't do the trick for me tho. DNS_FORWARDER was already set to those, I updated WILDCARD_ADDRESS (I did try with the old IP as well since it points to internal php container's ip, which kinda makes sense to me) and FORWARD_PORTS_TO_LOCALHOST, and I forwarded port for my docker-machine, but I think that was working already since I was able to access devilbox and my projects through the 192.168.137.130. Unless you meant something else by that.

Docker Hostname IP
php 172.16.238.10
httpd 172.16.238.11
mysql 172.16.238.12
redis 172.16.238.14
memcd 172.16.238.15
bind 172.16.238.100
Docker Host port Docker port
php - 9000
httpd 192.168.137.130:80 80
mysql 192.168.137.130:3306 3306
redis 192.168.137.130:6379 6379
memcd 192.168.137.130:11211 11211
bind 192.168.137.130:1053/tcp192.168.137.130:1053/udp 53/tcp53/udp

If it helps
If you need anything else just let me know. Really appreciate the help and the box itself.

@AgarvaiN
Copy link
Author

Sorry, one more thing, on my host machine do I leave the DNS set to 192.168.137.130?

@cytopia
Copy link
Owner

cytopia commented Jul 23, 2017

The actual issue is to find a common denominator:

The DNS server must resolve TLD_SUFFIX domains always to an IP address where the httpd server is. This must be equal for two places:

  1. From within the php container
  2. From your host computer (not the VirtualBox).

That means there must be one IP address that where you can reach the httpd server and this IP address must work from within the PHP container and from your host computer.

So either 172.16.238.11 or 192.168.137.130. In case none of the two work for both cases, we must somehow map it to 127.0.0.1. And that is what I tried to achive by forwarding the httpd port to the 127.0.0.1 of the php container. With that, the DNS server must resolve all domains to 127.0.0.1 as well. The last step is to have 127.0.0.1:80 on your host computer point to the webserver.

Additionally, The DNS server's port must be changed in .env to 53 and integrated as your primary DNS server for windows.

@cytopia
Copy link
Owner

cytopia commented Jul 23, 2017

Btw, is 192.168.137.130 reachable from within the PHP container?

@cytopia
Copy link
Owner

cytopia commented May 5, 2018

#248

I am already working on this problem. Please find all relevant information in the newly created issue: #248

To reach a broader audience I will close this ticket and link it to the new one (which will be done with multiple related issues as well).

@cytopia cytopia closed this as completed May 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants