How to bind a docker container and its virtual ethernet interface in a host
1 answer
Given eth0
inside the container, you need to find the peer_ifindex (which you can do with ethtool -S
) and then define that interface index on the host (s 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
+4
source to share