Docker Windows container communication
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 ROSMASTERURI=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 ROSMASTERURI for all the containers... which only happens since I set network to "bridge" and they got their own IP
Cheers, aur20
Asked by aur20 on 2023-01-25 11:58:17 UTC
Answers
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.
Asked by aur20 on 2023-01-29 10:47:23 UTC
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.
Asked by Mike Scheutzow on 2023-01-30 08:30:13 UTC