Docker Community Forums

Share and learn in the Docker community.

Docker layer 2 connection

I am working inside a container, trying to demonstrate linux bridge and Layer 2 connection.

I started a new container:

host$ docker run -it --rm --name c1 --privileged networking sh

On the container I used the following to create the bridge interface and tap interface

c1$ ip link add br0 type bridge
c1$ ip link set eth0 master br0
c1$ ip tuntap add tap0 mode tap
c1$ ip link set tap0 master br0
c1$ ip link set tap0 up
c1$ ip link set br0 up
c1$ ping -I tap0 172.17.0.2

The last ping command is not working.
What am I doing wrong ? is tap interface the correct one to use?
How can I show layer 2 connection on a container with linux bridge ?