How to edit /etc/hosts file in running docker container

Depends upon what sort of modifications you want to do. If you just need to add more hosts, you can probably do it within docker run command like –

docker run --add-host="localA:127.0.0.1" --add-host="localB:172.0.0.1" ....

This link might be useful as well :- https://github.com/docker/docker/issues/10324

Leave a Comment