[ROS2] Docker node communication

asked 2023-04-10 08:34:04 -0500

Ammar Albakri gravatar image

updated 2023-04-11 00:37:26 -0500

Configuration:

  • ROS Distro: Foxy
  • OS Version: Ubuntu 20.0 (Docker)

Hello, I am trying to use Docker to run Foxy inside my Ubuntu 22.04 system, I have successfully run the ros:foxy image and managed to establish communication between my host machine and the docker.

I am running a ros package that reads data from a sensor through ethernet and publishes it to a topic, the problem is I must use

--network=host

option in order for my package to reach the sensor IP, but when I do this my ros communication doesn't work anymore, even after setting ROS_DOMAIN_ID the same in the host machine and the docker.

Also if I try to use the default network setting for docker I cant reach the IP of my sensor.

What is the correct network setup to have a --network=host and still make ROS communicate?

edit retag flag offensive close merge delete