Tutorial 1 - Docker & ROS 2 Setup
Learn how to use Docker and ROS 2 to build your first containerized robotics environment.
Welcome to your first F1TENTH tutorial! This version includes embedded good coding habits, checklists, documentation links, upcoming visual demos, and now also outlines clear learning objectives, troubleshooting tips, and ROS 2 graph visualization guidance to support you as a beginner. This guide is built for first-year university students and assumes minimal experience with software development. It introduces two powerful tools used in robotics development: Docker and ROS 2. You'll learn core concepts, how to apply them, and gain hands-on experience along the way.
β Good Habit Reminder: Always look up official docs before using a command you're unfamiliar with. Bookmark Docker and ROS 2 now!
Step 1: Go to Docker Guide
Step 2: Go to ROS 2 Guide
Step 3: Continue This Page
1. Building and Running Inside Docker
Sample Dockerfile
Dockerfile FROM ros:humble RUN apt update && apt install -y python3-colcon-common-extensions WORKDIR /ros2_ws COPY . /ros2_ws RUN . /opt/ros/humble/setup.sh && colcon build CMD ["bash"]
Containerizing ROS 2 Projects
π Learn more: Dockerizing ROS 2 Projects
β Good Habits Checklist
- Add a
.dockerignorefile to keep images small - Re-tag and version your Docker builds
- Push only working builds to Docker Hub
π₯ Coming Soon: Visual: Docker build + colcon run demo
2. Final Assignment
Objective
- Build a containerized ROS 2 workspace
- Create a simple publisher node
- Launch it using Python
- Push your container to Docker Hub
- Submit via GitHub Classroom
β Track your changes: Keep a
CHANGELOG.mdfile from the start
3. Common Mistakes and Pro Tips
| Mistake | Fix |
|---|---|
| Not sourcing the setup script | Run source install/setup.bash |
| Permissions issue on volume | Add --user $(id -u):$(id -g) to docker run |
| Dependencies missing in package | Add to package.xml and setup.py |
β
Use tmux to keep sessions alive
β
Use volumes to persist work
β
Donβt put ROS source commands in .bashrc β see why here
4. Resources and Whatβs Next
π Troubleshooting Common ROS 2 Issues
π οΈ Colcon build fails with missing dependencies
Check yourpackage.xmlandsetup.pyto ensure all dependencies are listed.
Use:rosdep install --from-paths src --ignore-src -r -yto auto-install missing ones.
π οΈ Can't find installed packages
Make sure tosource install/setup.bashafter building. Never skip this step.
π οΈ Docker can't access local folder
Ensure you're using absolute paths with-vor--mount, and check permissions.
π§ Visualize ROS 2 Graph
Run this command to generate a visual diagram of how your nodes and topics are connected:
rqt_graphOr use:
ros2 run tf2_tools view_framesThis produces an image like the one below that shows your full ROS 2 computation graph.
π· (Insert SVG or screenshot of ROS graph visualization here)
Learn More
Coming Up
- Writing custom messages and services
- Simulating environments with Gazebo
- Connecting ROS 2 nodes over a network
π Congratulations
You now know how to:
- Use Docker to run isolated robotics environments
- Build ROS 2 packages from scratch
- Launch and test simple nodes
- Submit your containerized project professionally