1

I'm trying to use hostname based connecting to a docker container. i.e: I connect my browser to web01.docker.example.org (assuming a wildcard DNS record on *.docker.example.org pointing to my docker box). How do I enable docker to forward this request to my nginx docker for instance?

This idea is inspired by apache's VirtualNameHost model, which does this, except to a VirtualHost rather then a running container.

1

Do you want to dispatch connections to a different Docker container based on the hostname that was used to access it, using a single public IP address ?

That is not possible in general; docker operates with TCP or UDP conversations, and their endpoints are IP addresses, not hostnames.

If you want to do this with HTTP, you can setup a reverse proxy container, that will relay the HTTP request to the correct machine. Otherwise, you will have to use one distinct IP address per container.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.