docker-osx-dev icon indicating copy to clipboard operation
docker-osx-dev copied to clipboard

HTTP Proxy

Open digitalkaoz opened this issue 10 years ago • 11 comments

would be cool to have a http-proxy inside the VM just like https://github.com/codekitchen/dinghy#dns installing the container isnt an issue, the local dnsmasq stuff is a bit more tricky. would love to see this feature :)

digitalkaoz avatar May 24 '15 19:05 digitalkaoz

What's the main use case? The docker-osx-dev setup.sh script adds dockerhost to the /etc/hosts file, so you should be able to test your apps by going to http://dockerhost:12345.

brikis98 avatar May 24 '15 19:05 brikis98

yeah for sure, but it would be cool to define subdomains in your docker-compose file and those will be resolved into the correct container, so you dont have to fiddle around with ports (if you have running multiple web-apps on port 80 in your system)

so frontend.dockerhost resolves to the frontend-container backend.dockerhost resolves to the backend-container api.dockerhost resolves to the api-container

and so on...

currently we can only do it this way:

dockerhost:80 -> frontend-container dockerhost:81 -> backend-container dockerhost:82 -> api-container

digitalkaoz avatar May 24 '15 20:05 digitalkaoz

dinghy uses https://github.com/jwilder/nginx-proxy for that

digitalkaoz avatar May 24 '15 20:05 digitalkaoz

Ah, interesting. Couldn't that also be done by updating the /etc/hosts file? That's what Docker does within containers for when you use the link flag.

brikis98 avatar May 24 '15 20:05 brikis98

xeah sure that will work too, tested it myself with a running nginx proxy. It works like a charm. But etc/hosts isnt very flexible. If we add a http hosts we must rerun provisioning. With dnsmasq it would work all the time without updating some config Files and reloading

digitalkaoz avatar May 24 '15 20:05 digitalkaoz

Inside the Containers docker can mangle up /etc/hosts but please not on my hosts ;)

digitalkaoz avatar May 24 '15 20:05 digitalkaoz

The hosts are defined in the docker-compose file. So very flexible

digitalkaoz avatar May 24 '15 20:05 digitalkaoz

Yea, it's just a trade off between an extra dependency that you have to install/configure/manage, versus a known, simpler solution that already works and does 90% of what you want. Simplicity tends to be a better option, and having the script make a backup of /etc/hosts is not particularly hard (and probably a good idea anyway).

brikis98 avatar May 24 '15 20:05 brikis98

Mh its a One time Installation in your setup.sh

digitalkaoz avatar May 24 '15 20:05 digitalkaoz

I think docker-osx-dev is living in the middle of being a re-usable component and being the docker development tool (the Tool).

To be the Tool, docker-osx-dev would need to include this functionality, just like dinghy and dash.

Unfortunately, @brikis98 is right and this takes a lot of additional effort and comes with more dependencies.

I feel docker-osx-dev is best at being a component in a project like the Tool.

Thoughts?

dekz avatar Nov 03 '15 21:11 dekz

@dekz: I'm not against a PR that would add this. I would feel better about it if we had integration tests working though. See #97.

brikis98 avatar Nov 03 '15 21:11 brikis98