VS Code Dev Containers (Docker for Robotics Part 5)

This is the discussion topic for the video linked above. Please keep all replies relevant to the content, otherwise create a new topic.

Hi everyone! I followed this video and had a couple questions regarding this tutorial. I’ve messed with docker before but have always had this issue preventing me from fully using docker:

As a note: I have a pc running linux (no docker yet) and a windows machine running this docker container on the same network as I test this. I can ping one computers ip from the other with no issue. Not sure how to ping the container though from the linux pc.

Here is the issue:

I publish a message from one computer and can’t see it from the other computer. I’d ideally like to be able to do this to develop and see all the data coming from a robot remotely on my network. I also notice that publishing or running nodes in one terminal instance in the container does not communicate the ROS2 messages between other terminals as my pure ubuntu computer does without issue.

Would anyone know how to help me on this issue? I feel as though you will only be able to develop single launch file applications as different terminals can’t communicate. Also this brings up the issue of not being able to monitor the system using tools like RQT and Rviz2 even if you dealt with that limitation.

Overall this video is great and I really enjoy the ease of using the dev container to set up ROS2, but this is really limiting the ability to network between computers as ROS2 is designed to do.

I am not sure about the problem between terminals in the same container but network issues between Docker on Windows and pure Linux could be related to that: “The host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server.” Host network driver | Docker Docs

I have the same problem with MacOS. Have to use a full VM when talking to ROS nodes on other machines instead of Docker. If anyone knows a good workaround please let me know.

I have also another question: How do you people deal with ROS dependencies when using Docker?

Normally I would write package installations that I need for a specific project directly into my Docker file, so the installs are cached and don’t need to be reinstalled on every new container run. However when using ROS I usually use rosdep for consistency of installing package dependencies. The rosdep keys used might change a lot during the development process and furthermore the workspace is mounted after building the Docker Image.

Does someone has a good solution that does not involve manually keeping the rosdep keys in the package.xml files in sync with install commands in the Docker file but also doesn’t involve reinstalling everything everytime I rerun the container from the Image?