Home  >  Q&A  >  body text

linux - 如何从docker容器中获取宿主机的mac地址等信息

如何从docker容器中获取宿主机的mac地址等信息

ringa_leeringa_lee2743 days ago848

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 15:26:54

    The simplest way is to pass the host's MAC address as an environment variable when running the Docker container.

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 15:26:54

    The containers of

    docker are isolated in the subnet created by docker daemon, so the MAC of the host host cannot be obtained. This is also in line with the specifications of container isolation. Imagine if the container can directly access the host host, then Container isolation will be broken.

    reply
    0
  • Cancelreply