Not able to resolve my domain name on browser
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.)