What is the relation between docker0 and eth0?

后端 未结 2 1605
自闭症患者
自闭症患者 2020-12-13 04:52

I know by default docker creates a virtual bridge docker0, and all container network are linked to docker0.

2条回答
  •  春和景丽
    2020-12-13 05:31

    You can detect the relation by network interface iflink from a container and ifindex on the host machine.

    Get iflink from a container:

    $ docker exec ID cat /sys/class/net/eth0/iflink
    
    17253
    

    Then find this ifindex among interfaces on the host machine:

    $ grep -l 17253 /sys/class/net/veth*/ifindex
    
    /sys/class/net/veth02455a1/ifindex
    

提交回复
热议问题