Robotics StackExchange | Archived questions

How can I receive ros messages from docker containers?

I try to connect ros messages between host with ros2 (local machine) and a docker container with ros1 (on the same machine). The command that I used when deploying docker was

Given that I have a docker image pulled from docker hub

1. docker run --name ros_melodic --env ROS_MASTER_URI=http://172.17.0.1:11311 --env ROS_IP=172.17.0.1 -it ros:melodic-robot

2. docker run --net=host --name ros_melodic -it ros:melodic-robot

3. (mix between 1. and 2.)

docker run --net=host --name ros_melodic --env ROS_MASTER_URI=http://172.17.0.1:11311 --env ROS_IP=172.17.0.1 -it ros:melodic-robot

4.(similar to 2 but change write --net as --network and remove =)

docker run --network host --name ros_melodic -it ros:melodic-robot

The problem is that in a docker container I can get ros messages perfectly, but not on my local machine. So, I can't receive any ros messages outside the docker container.

Asked by Gunhos on 2023-05-24 21:56:32 UTC

Comments

Answers