I am trying to run a Linux container on an Windows 11 machine and I want to be able to access the container on my local LAN network.
My goal is to run a ROS in then container and talk to other nodes on my LAN.
Is this possible to do? I have tried both passing host and creating a macvlan network. I have not had success with either. I am not sure how to solve this problem
Are you running your container in Docker Desktop for Windows, or Docker-CE in WSL2 or a vm?
Docker Desktop will add a portforwarding rule that allows other machines in your lan to access the published port of a container attached to a bridge network. Host and macvlan do work, but are in the scope of the utility vm that runs Docker Desktop - so it will not work as you need it to work.
With Docker-CE in WSL2 or a vm, you need to setup portforwarding yourself.
I am using Docker desktop for windows. Does that mean that I should not pass in host and use the default bridge network? Do I manually have to pass in any ports?
Docker Desktop will make port 8080 accessible on the host on localhost and lan ip.
No. If this is what you need, then you need Linux + docker-ce, and need to use a macvlan network. If you run Linux and docker-ce in a vm on your Windows host, this may or may not work, depending on how the virtualization solution work. I won’t be able to give any recommendations or answer questions in that direction.
Thank you for the help and the patience. I am still having trouble and this is possible a ROS issue. When I use the bridge I get a 172.18.x.x IP address. I can run roscore but it does not seem like other machine on the network can see the rosmaster.
Does it mean that it depends on network broadcast message to be detected by clients on other machines? This is not possible with Docker Desktop.
Docker’s Bridge network + portfowarding is useful, if you have incoming traffic on specific udp or tcp ports on a container. It will not work with broadcast or multicast messages.
The 2nd half of my last post recommends what needs to be done. If you should consider running a vm solution on your Windows host, make sure it is able to assign ip’s of your lan to the vm.