This Docker container contains ROS 2 Jazzy, Gazebo harmonic, and the TurtleBot 4 simulation. The Docker container has been configured to work well on commodity hardware without a graphics card. Most reasonably configured hardware should be able to run the simulation with a real time factor of at least 0.2.
👉 This Docker container is meant to be used with this example code for a toy TB4 node and the associated ROSCon 2025 Workshop
👉 This Docker container includes a full ROS 2 Jazzy Jalisco desktio install. If you would like to brush up on your ROS skills you can work through the ROS 2 tutorials. We suggest you start with the CLI Tutorials.
This workshop let's you choose your own adventure. You have two big decisions to make:
- Build the container yourself -or- pull down the container from Github.
- In a classroom setting we recommend pulling the container down from Github.
- If you are at home we recommend you build the container yourself. It will allow you to build a ROS + Gazebo Docker container that fits your particular needs.
- Write the code yourself from scratch -or- follow along from a finished repository.
- We recommend you write the code yourself! It will give you experience with the ROS APIs and development process. You can always peek at the finished project for some help.
- If you want to follow along from the finished project you can clone the following repository into your working directory.
But wait, there's more! Do you just want to try out some of the great tutorials on docs.ros.org we also have instructions on how to do that too!
- ✅ Install Docker with
sudo apt install docker.io - ✅ You may need to add yourself to the Docker group with the command
sudo usermod -aG docker $(whoami) - ✅ Install Rocker (see instructions). Make sure to setup and use a Python virtual environment.
- ✅ Note your virtual environment's name and location. You'll need to call
source ./<venv>/bin/activatebefore starting your container.
If you would like to use the pre-build image run the following commands :
- ✅
docker pull ghcr.io/kscottz/roscon2025-intro-workshop:jazzy - Container on Github
- Now change the name of your Docker image using the tag command
- ✅
docker image tag ghcr.io/kscottz/roscon2025-intro-workshop:jazzy tb4
- ✅
If you would like to build the Docker container from scratch you will need to use the following steps.
- Clone this repository
git clone git@github.com:kscottz/turtlebot4_docker.git - Build the container using:
docker build . -t tb4 - REMEMBER tb4 is the name of your image in this case
If you simply want to start the Docker container use the following command:
✅ rocker --x11 --devices=/dev/dri tb4 bash
You have two primary options of saving your work from the workshop. You can either start from scratch and build everything yourself, or you can follow along from a finished project.
-
[recommended workflow] To start from scratch and save your work outside of the container then all you do is create a workshop directory and link it your Docker container using the following commands:
mkdir workshop- Now run,
rocker --x11 --devices=/dev/dri --volume=<full path to your directory>/workshop:/opt/ros/overlay_ws/src/workshop/ tb4 bashwhere the directory has been replaced by your new directory, and container is the container you want to use. - Here's an example from my system:
rocker --x11 --devices=/dev/dri --volume=/home/kscottz/Code/workshop/:/opt/ros/overlay_ws/src/workshop/ tb4 bash
-
If you want to work from a completely finished code example, please do the following
mkdir workshopcd workshopgit clone git@github.com:kscottz/tb4_toy.git-- here's the code if you just want to peek.- Now run,
rocker --x11 --devices=/dev/dri --volume=<full path to your directory>/workshop/:/opt/ros/overlay_ws/src/workshop/ tb4 bashwhere the directory has been replaced by your new directory, and container is the container you want to use. - Here's an example from my system:
rocker --x11 --devices=/dev/dri --volume=/home/kscottz/Code/workshop:/opt/ros/overlay_ws/src/workshop tb4 bash
Note that the workshop will require you to work inside the container at all times and should leave your host system mostly untouched. *If you happen to change the Docker container's internal configuration and want to save it, you will need to use docker commit to save your work.
If you plan to save your work from the workshop the files you create inside of the container will not have the correct permissions such that they can be edited outside of the container. To fix this you will need to change the ownership of the files. In a directory outside of the Docker container run the following command:
sudo chown -R $(whoami) ./workshop/
If your laptop has a fancy graphics card you can enable it by omitting the line: --devices=/dev/dri when you start your container. If you have a discrete graphics card we recommend you use it! If you don't have a graphics card, don't worry! We've specifically configured this workshop to work on older laptops.
The container for this workshop contains most of the common terminal editors found on Linux systems. You are more than welcome to use them. If you mounted your filesystem into Docker you can also use any editor on your host system If you have never used a terminal editor before this may be the easier approach.
We have a comprehensive guide to using this container without Rocker available here. This guide includes a number of Bash scripts that make starting an appropriate Docker container easy! This guide also provides some alternative approaches to performing ROS development inside of a container.
Once you have started your container you can launch ROS and Gazebo by first building the workspace and running the following commands.
source ./install/setup.bash
colcon buildNow you can start the Turtlebot4 simulation.
ros2 launch turtlebot4_gz_bringup turtlebot4_gz.launch.py world:=maze- Send a velocity command:
ros2 topic pub /cmd_vel_unstamped geometry_msgs/msg/Twist '{linear: {x: 2.0, y: 2.0, z: 2.0}, angular: {x: 0.0, y: 0.0, z: 0.0}}' -r 5 - Control the robot via keyboard:
ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args --remap cmd_vel:=cmd_vel_unstamped - Run the toy node:
ros2 run tb4_toy toy_node - Trigger the toy node service:
ros2 service call /do_loopy std_srvs/Trigger '{}'
- A full list of ROS resources including our Discord and Q&A website can be found here.
- A full list of Gazebo resources can be found here.
- The TurtleBot 4 manual can be found here.
- Docker cheat sheet.