IssueRaiser

Allow wildcard container host aliases

What: Allow wildcard aliases for containers in a network, so that any subdomain lookup will route to that container. Example: ``` # Start an nginx with a wildcard alias docker network create foonetwork docker run -d --network=foonetwork --net-alias=*.foo.local nginx # Check we can hit it at my.foo.local docker run -it --network=foonetwork alpine wget -O - http://my.foo.local ... expect HTML served from nginx ... # And at your.foo.local docker run -it --network=foonetwork alpine wget -O - http://your.foo.local ... expect the same HTML served from nginx ... ``` This doesn't work at the moment, wget responds with 'wget: bad address' indicating the DNS lookup failed. This is useful for testing applications which might route traffic based on hostname, for example multi-tenant web services. Requested in https://github.com/docker/compose/issues/7493, but I think this would need to be a part of libnetwork The workaround of running an additional DNS server in the network is, I think, quite complicated.

Posted by MFAshby on Mar 31, 2022, 4:09 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments

github (Network)

Allow wildcard container host aliases

MFAshbyMar 31, 2022, 4:09 PM

What: Allow wildcard aliases for containers in a network, so that any subdomain lookup will route to that container. Example: ``` # Start an nginx with a wildcard alias docker network create foonetwork docker run -d --network=foonetwork --net-alias=*.foo.local nginx # Check we can hit it at my.foo.local docker run -it --network=foonetwork alpine wget -O - http://my.foo.local ... expect HTML served from nginx ... # And at your.foo.local docker run -it --network=foonetwork alpine wget -O - http://your.foo.local ... expect the same HTML served from nginx ... ``` This doesn't work at the moment, wget responds with 'wget: bad address' indicating the DNS lookup failed. This is useful for testing applications which might route traffic based on hostname, for example multi-tenant web services. Requested in https://github.com/docker/compose/issues/7493, but I think this would need to be a part of libnetwork The workaround of running an additional DNS server in the network is, I think, quite complicated.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue