Streamlining ROS Development with Docker and VSCode DevContainers

Hello everyone,

As someone who’s been developing robots with ROS 2 for quite some time, I’ve recently transitioned to using Docker for its convenience. Integrating the VSCode devcontainer extension has been a game-changer, especially when working with multiple ROS development environments simultaneously. Having a consistent development environment across the team has been incredibly beneficial.

After iterative improvements, I’m excited to share a devcontainer configuration that works neatly and is super easy to configure. Even if you have basic experience with Docker, Linux, and Bash, you can make changes effortlessly.

Here is a part of the .env file:

# ROS Frameworks
# ros2_control
# nav2
# plansys2
IFRAMEWORKS='$ros2_control && $nav2'

Adding tools, frameworks, and ROS tools is now as simple as that!

Additionally, I’ve included features like VSCode tasks and bash history synchronization between the host and Docker environment to enhance the development experience.

GitHub repository: https://github.com/manojm-dev/devcontainer_for_ros

I’d love to hear your thoughts and suggestions on this setup. Please share your feedback and ideas

Do not aim to make it super easy to configure using alias commands, opaque scripts, and thin abstraction layers. Such super-easiness brings fragility and narrowness into your work, always.

Encourage users to modify Dockerfile or compose.yml directly instead.

You can also check the distrobox project (github.com/89luca89/distrobox) if you find containers useful for development. Then a tutorial for ROS developers can be interesting.

1 Like

Hi @manojm,

I recently implemented something similar using Devcontainer templates, have a look if it helps you: GitHub - tonynajjar/ros2_devcontainer_template

It can definitely be improved to include some of your sophisticated settings if they make sense for a majority of people

1 Like

Thanks for the tips! It makes sense to encourage direct modifications to the Dockerfile and compose.yml. I’m also looking at the distrobox project. Great suggestion!

Thanks for sharing, @tnajjar ! I’ll definitely check out your Devcontainer template.

Don’t forget about rocker and its many extensions by various people.

1 Like