how to run roscore in docker in wsl
I have been running ROS in a docker with the WSL 2 backend. For example:
docker run -it ros:noetic-ros-base
When I run roscore
in this, I cannot see the ros topics from outside the docker, i.e. rostopic list
in WSL fails. I have tried various ways of connecting the network to the WSL network, such as using the --network=host
option, but to no avail. Part of my goal is to run gazebo
in a docker and access it from within WSL, so I need to solve this network connection.
The question is: how can I run roscore
from inside the docker, and be able to publish / subscribe to it from outside the docker in WSL?