In my dockerized application I need to have a hardware anchor and thought about using the Container's Mac-Address. But: since the Mac-Address of a Docker container ist volatile and dynamically assigned at container startup I cannot use this Mac-Address (see Docker docs)
The MAC address is generated using the IP address allocated to the container to avoid ARP collisions, using a range from 02:42:ac:11:00:00 to 02:42:ac:11:ff:ff
The Mac-Address of the Docker host would be a viable solution.
How can I access the (linux) host's Mac-Address from within a container running on this host?
You can pass the mac address to the container as an env variable when starting it
docker run -e mac=$(ip link show eth0 | awk '/ether/ {print $2}') alpine env
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With