Communication between docker container and host system with Husarnet


I’m still very new to using Husarnet and Docker and I’m running into an issue that I can’t easily find a solution to.

I have a ros2 and husarnet container running on a windows system (similar to the ros2_examples eg4 example) and I need to be able to send data from an application built in windows that uses proprietary libraries. Since these libraries are proprietary, I can’t just rebuild the code within the container (or maybe a windows container is possible? but i’d rather avoid that if I can). My first thought was to use sockets that communicate over localhost between the host (windows) and the container. Does Husarnet allow for this functionality? The examples I’ve tried for communication over localhost don’t work. Any tips or suggestions for different routes to take would be great! Thank you!

Hi @CamRW,

Regarding your setup, is Husarnet the only Docker image you’re using on your Windows system? If yes, it might be better to install Husarnet directly on the Windows host instead. The installation guide can be found here: Installing Husarnet on Windows | Husarnet

For communicating ROS 2 nodes on a Windows computer with another computer, you need to configure a DDS config file to use the hnet0 network interface instead of the default ones. Check out this tutorial: Using Husarnet & ROS 2 | Husarnet

Let me know if this works for you.


Husarnet team

Hi Dominik,

Thank you for the speedy response. I could have everything on the host machine and I may go that route for simplicity. Ideally I’d have a Windows application communicating with an Ubuntu/ROS2 container so that I could expand on the project in the future, and because I prefer to develop on Linux and in containers :slight_smile: . I’ve added a rough diagram of what would be my ideal solution. But yes! For now I think I’ll just run our app wrapped in ROS2 architecture with Husarnet running on the base Windows OS. Thank you!!