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

  • How to install a local rpm file when building docker instance?
  • Intellij docker integration plugin and invalid volume specification on docker-machine for windows 10
  • How to make MySQL container run in the background when configured in docker-compose
  • How can I debug a docker push on Mac using docker-machine?
  • Can't Docker host more than one webserver?
  • Getting list of running docker containers using docker-py
  • I had the following command

    docker run -dit -p 8080:8080 --add-host someServer: --add-host myHostName: -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.

    Please help.

  • docker commit apache container to image brings trouble
  • Docker Swarm : How to setup multiple containers on same volume
  • create a “Best-effort” pod and its oom score not 1000 but -999
  • Jupyterhub/singleuser shared volume
  • Warning about system root certificate pool crypto/x509
  • Is that possible to get image ID from Docker Registry V2?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.