# Cannot connect interface to Docker container

**URL:** <https://forums.docker.com/t/cannot-connect-interface-to-docker-container/116218>\
**Category:** General\
**Tags:** docker\
**Created:** [October 8, 2021, 7:54pm UTC](https://forums.docker.com/t/cannot-connect-interface-to-docker-container/116218 "2021-10-08T19:54:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohamedaly8](https://avatars.discourse-cdn.com/v4/letter/m/aca169/32.png) [@mohamedaly8](https://forums.docker.com/u/mohamedaly8)\
**Post date:** [October 8, 2021, 7:54pm UTC](https://forums.docker.com/t/cannot-connect-interface-to-docker-container/116218/1 "2021-10-08T19:54:42Z")

</div>

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?
