I'm new to docker. I got latest docker (18.06.1-ce-win73 (19507)) and this version will somehow modify the hosts file and my company security team block anyone from modify the file. When we request to grant permission but they need to understand why the Docker modify Hosts file.
So could anyone explain why its modify file during startup?
Thanks
i'm new with docker too. But, reading this post (How to update /etc/hosts file in Docker image during "docker build") I understand you can update your /etc/hosts file during "docker build".
With a more recent version of docker, this could be done with docker-compose and its extra hosts directive (your version is here)
Add hostname mappings. Use the same values as the docker run client --add-host parameter (which should already be available for docker 1.8).
extra_hosts:
- "somehost:162.242.195.82"
- "otherhost:50.31.209.229"
In short: modify /etc/hosts of your container when running it, not building it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With