Docker on mac –add-hosts option isn't really adding the host
I have docker 1.12.3 running on macOS sierra.
I need my server to set serveral ips in the hosts file, and also set the containter hostname to resolve to 127.0.0.1.
I had the following command
docker run -dit -p 8080:8080 --add-host someServer:192.168.1.1 --add-host myHostName:127.0.0.1 -h myHostName myImage
So the hostname did changed to myHostName, and also added to the hosts file.
However, it doesn’t do anything!. Trying to use it in my server, or even just do ping myHostName resolve in
ping: unknown host
From the documation it look like it should work, but it doesn’t. I really need it and I don’t have any more ideas how to solve it.