Robotics StackExchange | Archived questions

Docker and ROS

Hello everyone,

As ROS works through TCP/IP communications, can we connect ROS nodes that are running on the host OS to nodes that are running into Docker containers ?

(so we can still have ROS without Docker on Windows communicating with ROS with Docker on a separate computer using Linux based OS)

Thank you in advance !!

Asked by matt27110 on 2018-05-17 11:37:18 UTC

Comments

Answers

There are a few ways to network ROS with docker. I'm not as familiar using containers on a windows host, but when using a linux host, I either use Docker's software defined networking features, or just bind the host's networking interfaces directly to be shared with the host running container.

The simplest of the two here would be just to pass -net=host argument to docker's run command when starting the container, the ROS networking is rather transparent and mimics how you normally use ROS as if it was running directly on host:

host: Use the host's network stack inside the container.

https://docs.docker.com/engine/reference/run/#network-settings

This is also useful if you have a mix of ROS processes running in the container and in the host, such as when you'd like to run rviz natively from the host os rather than deal with piping it's GUI display from inside a container.

When using docker container with windows or mac os hosts, i.e. using a small hypervisor to host the linux kernel, this then adds your average VM networking complexities. E.g. just accommodating ROS standard network setup:
http://wiki.ros.org/ROS/NetworkSetup

If you'd like to use docker's software networking feature, I'd recommend configuring the system using docker-compose. This is more useful if you are managing multiple ROS networks/masters on a single machine.
https://docs.docker.com/compose/networking/

Asked by ruffsl on 2018-06-19 15:00:40 UTC

Comments