Docker Community Forums

Share and learn in the Docker community.

Cannot connect interface to Docker container

I am trying to connect a device (LiDAR) through Docker since it needs Ubuntu 16 while my computer is Ubunutu 20.

I got the device to ping inside the docker container, but it is not recognised when I try to use it.

What I did:

Made Dockerfile with requirements (Added EXPOSE to expose all ports)

Built docker image using:
docker build -t testLidar

I then made a container using
docker run -d -P --name testLidar (imagename)

I am able to ping my LiDAR IP inside the container, but when I do ip a I cannot see the interfaces connected to my machine.

Note : I have done the exact same steps but on an Ubuntu 16 machine. The only change was the docker run command had --net host instead of -P tag and my device worked perfectly. I feel like this is the root of my problem.

Been stuck on this for 3 days, any suggestions?