Getting Mac Address from Docker Container

Can I get the MAC address of the host machine from the Docker container and write it to a text file?

+5
source share
1 answer
docker inspect <container name or id> |grep MacAddress|tr -d ' ,"'|sort -u 

or inside the container:

 ifconfig -a 

ifconfig is part of linux pkg 'net-tools', and this is a good way to get into a running container:

 nsenter -t $(docker inspect --format '{{ .State.Pid }}' <container name or id> ) -m -u -i -n -p -w 
+3
source

Source: https://habr.com/ru/post/1266465/


All Articles