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

Docker Windows container communication

asked 2023-01-25 10:58:17 -0500

aur20 gravatar image

Hi all,

let's structure this in [Background], [Facts] and [Problem]. Feel free to only read problem.

Background:

  • I must use Windows 10 from company
  • Docker backend is WSL2
  • Development is later deployed to Raspberry Pi
  • ROS Noetic Container works fine
  • Every application has its own container
  • Until now, my network was set to "host" which reportedly not works under Windows
  • I want to run rviz which is poorly slow from inside the container like this Guide, so I installed Noetic under Windows

Facts:

  • All container are able to communicate without any setup
  • Communication from/to Windows is not possible

Problem: now for the really fun thing

  • Running roscore on Windows and trying to connect from container does sometimes work: if I specify ROS_MASTER_URI=http://host.docker.internal:11311/ and ROS_HOSTNAME=host.docker.internal, then start rqt it works. From within the container I can do other things like rostopic and so on...
  • Another container, same setup, trying to start my usual app via roslaunch does not work

  • Launching roscore in container, running rostopic on Windows does nothing at first. Later I changed network from "host" to "bridge" and enable forwarding of port 11311, now being able to do rostopic.
  • Being able to see topics, I naively launch rviz on Windows. -> No topic nor translation is received.
  • As this is how I intend to proceed: Do I have to forward every port from now on or are there better solutions? Also, it's quite tedious to set up the ROS_MASTER_URI for all the containers... which only happens since I set network to "bridge" and they got their own IP

Cheers, aur20

edit retag flag offensive close merge delete

Comments

In general on this site, we only "close" questions that are duplicates or if there is something else wrong with them. My opinion is that you should re-open it.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2023-01-30 07:30:13 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-01-29 09:47:23 -0500

aur20 gravatar image

updated 2023-01-29 09:47:46 -0500

There's me again.

Short answer: It is not possible.

Long answer: Docker in WSL2 can use --network=host, it will use kinda bridged network with the WSL but I cannot enter from Windows. This is because Ubuntu will be reachable, lets say for example at 172.19.48.1 which you can query from ipconfig. Then, Docker containers get assigned an IP like 172.19.58.1 which I found by installing ifconfig inside the container (Yes, I've read that it's outdated but anyways...). At my equipment it is not possible to have a route reaching that container.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-01-25 10:58:17 -0500

Seen: 1,123 times

Last updated: Jan 29 '23