I am an infra admin for providing docker images to developers.
I created "A" images and then tell docker run command is
docker run --add-host=a-lic:10.0.0.1 --add-host=b-lic:10.0.0.2 A
every developers request to me, please remove --add-host option because it is long. So I want to edit /etc/hosts file when docker build if possible.
I find out docker build --add-host
option newly create from 17.04
but it does not work as my expected.
someone said --add-host option is for only during building image and another said --add-host option will work as below (my thoughts).
docker build --add-host=a-lic:10.0.0.1 -t A .
docker run -it A
And docker's documentation is not sufficient for this.
$ docker build --help
Usage: docker build [OPTIONS] PATH | URL | -
Build an image from a Dockerfile
Options:
--add-host list Add a custom host-to-IP mapping (host:ip)
What is the correct??