@khatribharat is correct; however, to be able to cat the files in question, you need cat available inside your container. Iām often working with containers that are simple compiled binaries and donāt have access to normal utilities. In that case, you can still get at the needed information, but it requires a little more work. So I made a script to correlate containers with their veth interfaces: https://github.com/micahculpepper/dockerveth
Another way, albeit not perfectly simple, is to first do a ādocker psā and see what ports a container is using.
Then do a āiptables -S -t natā to see which bridge that port is DNAT:et to.
In order to identify the relation between the veth on the host and eth0 interface on the container, we can check the interfaces on the container using the following command:
[root@docker js]# docker exec -it dc ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever 94: eth0@if95: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP
link/ether 02:42:ac:11:00:03 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.3/16 brd 172.17.255.255 scope global eth0
valid_lft forever preferred_lft forever
We can see that the eth0 is suffixed by if[number]. This number also prefixed to corresponding the host virtual interface (veth). To validate this, check the network interfaces on the host:
[root@docker js]# ip a | egrep veth
93: veth5e8ceb7@if92: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default 95: veth3de0e04@if94: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default