Search code examples
dockerdocker-composelocalhosthost

curl: (6) Could not resolve host, when access subdomain


Below is the URL. Below url is working for only localhost.

curl http://test.redzilla.localhost:3000/

I want to know how to get access above URL from outside the server.

I tried it by doing like below.

curl http://test.redzilla.11.75.65.34:3000/

after executing the above code below error was triggered.

curl: (6) Could not resolve host: test.redzilla.11.75.65.34

I just want a way to access above URL from outside the server. There is multiple instances. each instance have a URL like above. Instances count dynamically changed.


Solution

  • You need DNS to resolve the hostname. You can use a free wild card DNS service like xip.io:

    curl http://test.redzilla.11.75.65.34.xip.io:3000/