I am using docker for application and modified the hosts file and added domain name on local browser. I added in hosts: xyz.com

but when I am trying to open from browser getting the following error:

This page isn’t working

xyz.com is currently unable to handle this request.

What I am doing wrong? Same application running in different OS like windows and ubuntu but here I am facing issues.

  • xyz.com or www.xyz.com? - they are treated differently
    – Tetsujin
    Oct 26, 2019 at 11:22
  • actually i tried for abc.xyz.com
    – Sikander
    Oct 26, 2019 at 15:41
  • Just a thought but you likely don't own that particular domain (xyz.com) and if you give it a non-routable name (xyz.local) that is only available on your local network does that change anything? Oct 26, 2019 at 19:21
  • actually i am trying on local machine only but still its not working
    – Sikander
    Oct 27, 2019 at 4:52

1 Answer 1


If you are modifying /etc/hosts in the Docker container itself, then only processes within the Docker container are going to be able to resolve that domain locally.

Thus, if you are using a browser on your Mac to access a port exposed by Docker, it knows nothing about the DNS override and will try to hit the real site -- which likely explains the message you're getting.

You need to append to your Mac's /etc/hosts. (You'll need sudo, a text editor, and to ensure you left the file owner, group, and permissions unchanged when you're done.)

  • I have already added in my Mac's /etc/hosts, but its not reflecting showing same 500 internal error
    – Sikander
    Oct 27, 2019 at 4:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .