Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I found a partial answer to this. The reason --network=host option fails has to do with how Docker relates to WSL; I believe it is in a VM. Anyway, the host the container sees is actually the Windows host which has a different IP address than WSL.

The key to enable roscore to communicate is to publish the port it uses, which is 11311 by default. Thus I can do:

docker run  -it -p 11311:11311 ros:noetic-ros-base

Then doing roscore in the container and rostopic list in WSL will show the published topics.

The reason this is a partial answer is that it does not enable ROS publishing / subscribing between the container and WSL. This is because each topic is assigned a random to communicate, and only port 11311 has been shared between the Docker and WSL. I don't know how to share all the ports that ROS might use.

I found a partial answer to this. The reason --network=host option fails has to do with how Docker relates to WSL; I believe it is in a VM. Anyway, the host the container sees is actually the Windows host which has a different IP address than WSL.

The key to enable roscore to communicate is to publish the port it uses, which is 11311 by default. Thus I can do:

docker run  -it -p 11311:11311 ros:noetic-ros-base

Then doing roscore in the container and rostopic list in WSL will show the published topics.

The reason this is a partial answer is that it does not enable ROS publishing / subscribing between the container and WSL. This is because each topic is assigned a random port to communicate, communicate on, and only port 11311 has been shared between the Docker and WSL. I don't know how to share all the ports that ROS might use.

I found a partial answer to this. The reason --network=host option fails has to do with how Docker relates to WSL; I believe it is in a VM. Anyway, the host the container sees is actually the Windows host which has a different IP address than WSL.

The key to enable roscore to communicate is to publish the port it uses, which is 11311 by default. Thus I can do:

docker run  -it -p 11311:11311 ros:noetic-ros-base

Then doing roscore in the container and rostopic list in WSL will show the published topics.

The reason this is a partial answer is that it does not enable ROS publishing / subscribing between the container and WSL. This is because each topic is assigned a random port to communicate on, and only port 11311 has been shared between the Docker and WSL. I don't know how to share all the ports that ROS might use.

I found a partial partial answer to this. The reason --network=host option fails has to do with how Docker relates to WSL; I believe it is in a VM. Anyway, the host the container sees is actually the Windows host which has a different IP address than WSL.

The key to enable roscore to communicate is to publish the port it uses, which is 11311 by default. Thus I can do:

docker run -it -p 11311:11311 ros:noetic-ros-base

Then doing roscore in the container and rostopic list in WSL will show the published topics.

The reason this is a partial partial answer is that it does not not enable ROS publishing / subscribing between the container and WSL. This is because each topic is assigned a random port to communicate on, and only port 11311 has been shared between the Docker and WSL. I don't know how to share all the ports that ROS might use.

I found a partial answer to this. The reason --network=host option fails has to do with how Docker relates to WSL; I believe it is in a VM. Anyway, the host the container sees is actually the Windows host which has a different IP address than WSL.

The key to enable roscore to communicate is to publish the port it uses, which is 11311 by default. Thus I can do:

docker run -it -p 11311:11311 ros:noetic-ros-base

Then doing roscore in the container and rostopic list in WSL will show the published topics.

The reason this is a partial answer is that it does not enable ROS publishing / subscribing between the container and WSL. This is because each topic is assigned a random port to communicate on, and only port 11311 has been shared between the Docker and WSL. I don't know how to share all the ports that ROS might use.

Edit: I think the solution is to run Docker directly in Windows. In that case the solution is easy:

docker run -it --network=host ros:noetic-ros-base

I can run roscore in one container and publish / subscribe in another container. All the containers have the same IP address, so no need to adjust ROS_MASTER_URI. The only downside as far as I can tell is that Docker may not run as efficiently as it does with WSL.

I found a partial answer to this. The reason --network=host option fails has to do with how Docker relates to WSL; I believe it is in a VM. Anyway, the host the container sees is actually the Windows host which has a different IP address than WSL.

The key to enable roscore to communicate is to publish the port it uses, which is 11311 by default. Thus I can do:

docker run -it -p 11311:11311 ros:noetic-ros-base

Then doing roscore in the container and rostopic list in WSL will show the published topics.

The reason this is a partial answer is that it does not enable ROS publishing / subscribing between the container and WSL. This is because each topic is assigned a random port to communicate on, and only port 11311 has been shared between the Docker and WSL. I don't know how to share all the ports that ROS might use.

Edit: Edit: I think the solution is to run Docker directly in Windows. In that case the solution is easy:

docker run -it --network=host ros:noetic-ros-base

I can run roscore in one container and publish / subscribe in another container. All the containers have the same IP address, so no need to adjust ROS_MASTER_URI. The only downside as far as I can tell is that Docker may not run as efficiently as it does with WSL (but I'm not sure of this).

Edit 2: Actually the same Docker containers can be run directly from WSL. What this means is that with the --network=host option, all the containers can communicate with each other in ROS. They just cannot communicate with WSL.

I found a partial answer to this. The reason --network=host option fails has to do with how Docker relates to WSL; I believe it is in a VM. Anyway, the host the container sees is actually the Windows host which has a different IP address than WSL.

The key to enable roscore to communicate is to publish the port it uses, which is 11311 by default. Thus I can do:

docker run -it -p 11311:11311 ros:noetic-ros-base

Then doing roscore in the container and rostopic list in WSL will show the published topics.

The reason this is a partial answer is that it does not enable ROS publishing / subscribing between the container and WSL. This is because each topic is assigned a random port to communicate on, and only port 11311 has been shared between the Docker and WSL. I don't know how to share all the ports that ROS might use.use. (The -P option does not seem to work.)

Edit: I think the solution is to run Docker directly in Windows. In that case the solution is easy:

docker run -it --network=host ros:noetic-ros-base

I can run roscore in one container and publish / subscribe in another container. All the containers have the same IP address, so no need to adjust ROS_MASTER_URI. The only downside as far as I can tell is that Docker may not run as efficiently as it does with WSL (but I'm not sure of this).

Edit 2: Actually the same Docker containers can be run directly from WSL. What this means is that with the --network=host option, all the containers can communicate with each other in ROS. They just cannot communicate with WSL.

I found a partial answer to this. The reason --network=host option fails has to do with how Docker relates to WSL; I believe it is in a VM. Anyway, the host the container sees is actually the Windows host which has a different IP address than WSL.

The key to enable roscore to communicate is to publish the port it uses, which is 11311 by default. Thus I can do:

docker run -it -p 11311:11311 ros:noetic-ros-base

Then doing roscore in the container and rostopic list in WSL will show the published topics.

The reason this is a partial answer is that it does not enable ROS publishing / subscribing between the container and WSL. This is because each topic is assigned a random port to communicate on, and only port 11311 has been shared between the Docker and WSL. I don't know how to share all the ports I've seen a solution where you publish a particular port and require the node to use that ROS might use. (The -P option does not seem to work.)port, but that is too clunky for my applications.

Edit: I think the best option solution is to run Docker directly in Windows. In that case the solution is easy:either in Windows or WSL with the --network=host option:

docker run -it --network=host ros:noetic-ros-base

I can run roscore in one container and publish / subscribe in another container. All the containers have the same IP address, so no need to adjust ROS_MASTER_URI. The only downside as far as I can tell is that Docker may not run as efficiently as it does with WSL (but I'm not sure of this).

Edit 2: Actually the same Docker containers can be run directly from WSL. What this means is that with the --network=host option, all that, while the containers can communicate with each other in ROS. They just other, they cannot communicate with nodes in WSL.

I found a partial answer to this. The reason --network=host option fails has to do with how Docker relates to WSL; I believe it is in a VM. Anyway, the host the container sees is actually the Windows host which has a different IP address than WSL.

The key to enable roscore to communicate is to publish the port it uses, which is 11311 by default. Thus I can do:

docker run -it -p 11311:11311 ros:noetic-ros-base

Then doing roscore in the container and rostopic list in WSL will show the published topics.

The reason this is a partial answer is that it does not enable ROS publishing / subscribing between the container and WSL. This is because each topic is assigned a random port to communicate on, and only port 11311 has been shared between the Docker and WSL. I've seen a solution where you publish a particular port and require the node to use that port, but that is too clunky for my applications.

Edit: I think the best option solution is to run Docker directly either in Windows or WSL with the --network=host option:

docker run -it --network=host ros:noetic-ros-base

I can run roscore in one container and publish / subscribe in another container. All the containers have the same IP address, so no need to adjust ROS_MASTER_URI. The only downside as far as I can tell is that, while the containers can communicate with each other, they cannot communicate with nodes in WSL.