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.
The simplest way is to pass the host's MAC address as an environment variable when running the Docker container.
The containers of
docker
are isolated in the subnet created bydocker 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.