The man page that you referenced is very old (ancient) - it's from 1995. Looking at the man page for gethostbyname on a machine running El Capitan (2006), that reference is no longer there meaning it's a very good indication that what you are looking for has been deprecated.
As stated, it's pretty difficult to do this. However, if you're willing to change the goal a little, and use a name ending in ".local" instead of ".com", it's trivial (in fact, it's already being done for you).
Let me start with a little networking theory. I think you're mixing up two different levels: name resolution and routing.
Name resolution is how ...
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 ...
Edit your hosts file:
sudo vi /etc/hosts
Add URLs you want to block. This should be sufficient:
# Block YouTube
Reset the Directory Service cache
Ping the the hosts for ...
1.) red-panda is your current computer name.
Click Apple Menu on Top Left
Open the System Preferences... App
Type Computer Name in Search
Change the red-panda to whatever you like, I would suggest something short, like KM, if you plan to use Terminal a lot
Close System Preferences... App
To securely wipe your hard drive, do an after-restart system ...
Your reasoning about the hosts file is actually not how it works. The hosts file is only responsible for providing a mapping from the hostname (alpha.com) to an IP - it doesn't have any influence on which hostname the browser sends to the webserver for virtual hosting.
If you do actually end up on the new server, you have an error in your web server ...
Pi Hole is my current favorite DNS sinkhole these days and simplifies our efforts ...
In the case of networked accounts and networked home folders, a user can login to any Mac on for example a company network and see their own files and have their own preferences set.
This is the case where you can use the -host feature. Say that you want for example one wallpaper on your own desktop, but another when you login to the shared office Mac in ...
127.0.0.1 localhost ibb.local
I've had a similar issue on my mac a while ago, and nothing past the first declaration per IP was active. Listing all domain names that need to route to 127.0.0.1 on the same line addressed the issue.
Unless something is sneakily misspelled, your config looks OK otherwise.
(And I also used something**.local** and ...
I think I just found the answer to this problem. If you are working on a virtual machine, as I am, and you change the /etc/hosts file in your virtual linux machine, only chrome will detect that. You will need to change the hosts file in windows (c:\windows\system32\drivers\etc\hosts) in order to force firefox to check the table. The moment I change that file,...