ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The easiest approach will be to setup the two containers to be on the same network segment. There's lots of ways to do this the docker networking documentation is here: https://docs.docker.com/engine/userguide/networking/

You'll likely want to use Docker Compose to automate the multi container launching. I recommend reading the Docker Compose Documenation

The easiest approach will be to setup the two containers to be on the same network segment. There's lots of ways to do this the docker networking documentation is here: https://docs.docker.com/engine/userguide/networking/

You'll likely want to use Docker Compose to automate the multi container launching. I recommend reading the Docker Compose Documenation

Update: @gvdhoorn is right that the new docker behavior is to default to running the containers on the same network.

I verifed I can just run this on one terminal

$ docker run -ti --rm osrf/ros2:ardent-full ros2 run examples_rclcpp_minimal_publisher publisher_member_function
[INFO] [minimal_publisher]: Publishing: 'Hello, world! 0'
[INFO] [minimal_publisher]: Publishing: 'Hello, world! 1'
[INFO] [minimal_publisher]: Publishing: 'Hello, world! 2'
[INFO] [minimal_publisher]: Publishing: 'Hello, world! 3'
[INFO] [minimal_publisher]: Publishing: 'Hello, world! 4'
[INFO] [minimal_publisher]: Publishing: 'Hello, world! 5'
[INFO] [minimal_publisher]: Publishing: 'Hello, world! 6'
...

And in a 2nd terminal:

$ docker run -ti --rm osrf/ros2:ardent-full ros2 run examples_rclpy_minimal_subscriber subscriber_member_function
[INFO] [minimal_subscriber]: I heard: "Hello, world! 34"
[INFO] [minimal_subscriber]: I heard: "Hello, world! 35"
[INFO] [minimal_subscriber]: I heard: "Hello, world! 36"
[INFO] [minimal_subscriber]: I heard: "Hello, world! 37"
...