VSCode Dev Containers for Package Maintenance across Distributions

TL;DR - Dev Containers ROS 2 is a repository that contains ready-to-use environment that lets you work across different ROS 2 installations / distributions. You should try it out!


Many ROS 2 packages are released across different ROS 2 distributions, and docker seems to currently be the most popular way of developing and testing. As a package maintainer, you often have to switch between distros (that target different platforms), to investigate bugs and fix them.

I maintain a couple of packages across different ROS 2 distributions, and so far, I’ve really liked using VS Code Devcontainers with ROS 2 Docker Images. However, these docker containers include the very minimum, and isn’t enough to set up a ROS 2 development environment similar to native development.

Dev Containers ROS 2 is a repository that I initially wrote just for myself to make maintaining packages across different distritbuions easier, but I’ve started to feel that its useful for others, so I’ve brushed it up and made it available. :partying_face:

It has dev containers for:

  • Foxy (core, base, desktop)
  • Galactic (core, base, desktop)
  • Humble (core, base, desktop, desktop-full)
  • Rolling (core, base, desktop, desktop-full)

It has settings included that enables:

  • Can open GUI applications
  • apt dependencies are up-to-date
  • can clone a repository with git clone git@github.com:/... (openssh-client is installed)
  • gdb is installed
  • source /opt/ros/${ROS_DISTRO}/setup.bash already added to ~/.bashrc
  • Uses the host network interface (so can communicate across your network)
  • Can access your webcam

Please give it a try! I’m interested to hear ways to go about improving it too. :face_with_monocle:

Also, here is a great article about using ROS 2 with dev containers by Allison Thackston - VSCode, Docker, and ROS2.

11 Likes

This is awesome! I use a very similar set up. Have you considered directly adding extensions to the devcontainer.json? Maybe some basic ones like python, c++, and maybe even the ros extension.

Hi @Jaron, thanks!

VS Code Dev Containers lets you install your locally installed Extensions into your docker container through one-click. I’ve added instructions in the README on how to do this.

I believe that is better than me selecting a handful of extensions to have pre-installed :slight_smile:

1 Like