I want to make it so that the Docker container I spin up use the same /etc/hosts
settings as on the host machine I run from. Is there a way to do this?
I know there is an --add-host
option with docker run
, but that's not exactly what I want because the host machine's /etc/hosts
file may be different on different machines, so it's not great for me to hardcode exact IP addresses/hosts with --add-host
.
/etc/hosts
into account (indirectly). I had the same situation and my solution was to edit/etc/docker/daemon.json
to point to a simple DNS proxy which reads/etc/hosts
.