How can you make the Docker container use the host machine's '/etc/hosts' file?

后端 未结 11 1794
夕颜
夕颜 2020-12-23 11:21

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

11条回答
  •  借酒劲吻你
    2020-12-23 11:53

    All three options work for me.

    1. Using the host's network (--network=host)
    2. Using extra_hosts in the Docker options
    3. Mapping file /etc/hosts from the host to the container

提交回复
热议问题