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

  • docker exec. What if there is no shell process?
  • DashDB local (docker) failed to start because database services didn't start
  • Docker, how to deal with ssh keys, known_hosts and authorized_keys
  • How to use docker image, without mounting the default volumes?
  • How to mount container-writable host directory?
  • How to Set Capabilities on Node Browser with selenium Docker
  • 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.

  • Forwarding domains to docker containers
  • Elastic Beanstalk Docker - How to get container logs
  • How do I push an image to my NON-public repo in dockerhub
  • How to deploy jar/war to nexus in the docker build?
  • how to correctly remove previous commits of an image in order to build it from the very scratch
  • Accessing to mysql from host to container in cli
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.