I am trying to port a linux app of my own to run in docker.
My app do an auto-discovery on the network to automatically identify target devices on the network.
I use “nmap -v0 -sn <ip/cidr>” and the new founded hosts are added to arp table.
Next, I search the arp table by opening /proc/net/arp and parse the lines looking for target mac addresses.
This works in the standalone app, but not when in the docker.
Looks like the docker start with a copy of host arp table and it is immutable, I mean, pinging a host inside the docker environment, did not change the arp table.
I got this conclusion by running my docker as “docker run -it --network host miguel/tst bash” and found the arp table (ip neig) already populated with the same content than the host. Also, running nmap -sn (inside the docker env) did not add new entries to the docker arp table, however, if I run nmap on the host (outside docker) than the docker arp table gets immediately updated .
Strangely, if I run “ip neigh flush dev enp3s0” INSIDE the docker env, the host arp table gets flushed.
So, adding new entries FROM docker didn’t work, but flushing it, works !
How can I run a network scan inside a docker app that causes the docker’s arp table to change ?
Looks like I need to detach the host arp table from the docker’s arp table.