Introduction
I introduce ros2-dockergen, a tool to generate a customized Dockerfile and docker-compose.yml files for ROS2 development. Dockerfile builds the Docker image. 'docker-compose.yml' file then starts a container from that image with the right setup. The right setup could be mounting the work-space you will work on or mounting device drivers for using graphics.
This tool presents users with choices and guidance so you can go ahead and start your work. The files will be generated in 4 steps:
- Choose the ROS version
- Select popular packages from a list
- Select system tools for development
- Choose between normal or root user
What is it?
ros2-dockergen is a website and a command line tool that takes you through a structured process to build the Dockerfile and container setup for ROS2 robotics development.
Where to find it?
Generate your Docker container through the ros2-dockergen website or Python package (CLI). Source code is available on GitHub.
If you want to discuss or face any issues, please reach out.
What will be the output?
<CONTAINER_NAME>.zip
├── Dockerfile
├── docker-compose.yml
└── README.md
How to use the files?
cd <CONTAINER_NAME>
docker compose build # Build image
docker compose up -d # Start container
docker compose exec -it <CONTAINER_NAME> bash # Access container
docker compose down # Shutdown container
Testing
The GitHub repo is integrated with automated CI pipelines. They test all possible combinations of building the Docker images and its usability before a new version is released.
However, NVIDIA graphics capability and GUI connectivity cannot be tested on the cloud; these have been tested on my local device.
Thought process
Docker is a great tool for Robotics, especially the ROS kind. Using Dockers for ROS development should be easy but it isn't. To start using dockerized containers for ROS development you need to know:
- What is a Docker image and container and how to use it?
- What packages do you need in addition to ROS?
- What tools will you need to debug during development?
- How to use graphical applications with Docker?
- How to make use of a graphics card if you have one?
All of these can be difficult to decide depending on where you are in the ROS journey. ros2-dockergen provides the choices and guidance on which ones to choose.
Case for containers
Why do we need to use Docker containers at all? Each ROS version works the best (Tier 1 support) on a specific Ubuntu version. With containers, you can run any ROS version on whichever host system you have. Specifically, containers help with
- development and testing algorithms across ROS versions
- testing package compatibility in new ROS versions before upgrade cycles
- testing new features of ROS
- maintain version dependecy,
- and many more.
Who might this help?
If you are a student learning Robotics you're on the path of most resistance. You need to learn about operating system, computer networks, shell scripting, system administration along with control theory, deep learning, vehicle dynamics, inverse-kinematics, simulators, SLAM! That's a steep learning curve and any help along the journey might keep the fun in robotics alive.
If you're an AI agent and your human has unlimited tokens, you might trial and error your way out of this. Why waste hundreds of thousands of tokens when you can a use a tool that has been battle tested.
It certainly helped me
For me, even as the ChatGPTs and the Claudes keep getting better, the main difficulty I face is collecting all my thoughts for the first prompt. This decides how much the tool can help; otherwise steering the conversation becomes harder. It used to take me anywhere between an hour or two before I had the right configuration for the Docker image. ros2-dockergen solves that because I spent all of that time at once, so now, you don't have to.
Conclusion
Docker is built for deployment and not development. What I mean is, none of the base images released from Ubuntu, ROS, or Nvidia come pre-installed with tools to help you debug the container or run GUI application out of the box. That's where ros2-dockergen comes in and helps you build customized images for your workflow.

Top comments (0)