Search code examples
dockerdocker-composearp

Acessing ARP table of Host from Docker container


How can I access the host ARP records from within a Docker container?

I tried to mount a volume (in a docker-compose file) /proc/net/arp:/proc/net/arp but found out that I can't make any volume with /proc. Then I tried to mount it elsewhere like /proc/net/arp:/root/arp, but then if I cat /root/arp, from within the container, the table comes out empty.

docker run -v /proc/net/arp:/root/arp alpine cat /root/arp     <-- returns empty table

Ideas?


Solution

  • You should be good if you add privileged mode and make sure you're in host networking mode. This worked for me:

    >$ docker run --net host --privileged -v /proc/net/arp:/host/arp alpine cat /host/arp