4

Each container is associated to a virtual Ethernet interface on the host named like veth7K7R1J. I can find it in /sys/class/net/veth7K7R1J/statistics. But I'm wondering how to find this relationship. Is there a way to do this?

1 Answer 1

5

Given eth0 inside the container, you need to find the peer_ifindex (which you can do with ethtool -S) and then identify that interface index on the host (with ip link). So:

$ docker run -it --rm ubuntu:14.04.2 bash
root@07e330775e98:/# apt-get update && apt-get install -y ethtool
[...]
root@07e330775e98:/# ethtool -S eth0
NIC statistics:
     peer_ifindex: 875

Then on the host again:

$ ip link | grep '^875:'
875: vethdd8c173: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.