I have a client who need to spin up webservers on demand to quickly test code and content, they use Docker to host these sites.
Currently they expose each site an a different port - which needs to be configured both within the container so that it can perform appropriate redirects, and by the user needing to get to the right site.
I’m automating the spin up process and wanted to make this a bit smoother.
I like to use wildcard DNS for ephemeral servers such as these.
A wildcard DNS record is a record in a DNS zone that will match requests for non-existent domain names.
A wildcard DNS record is specified by using a * as the leftmost label (part) of a domain name, e.g. *.example.com.
I just point this address at my Docker server and then any name like website1.testsites.example.com will resolve to my docker host.Read more ...