Main Content

Install and Set Up Docker for ROS, ROS 2, and Gazebo

This page provides installation instructions for Docker and guides you through building a Docker image from the Dockerfile included in the Docker and Support Files for ROS Toolbox repository, which is provided as a supplement to ROS Toolbox. The Docker image comes preinstalled with Gazebo and ROS, enabling MATLAB® and Simulink® to seamlessly integrate with the Gazebo robot simulator and an external ROS (Robot Operating System). Once you build the Docker image following the given instructions in this page, you can create instances of Docker container to run the relevant examples in ROS Toolbox.

Built on Ubuntu® 24.04 Noble, this Docker image works on multiple platforms, including Windows®, Linux®, and Mac.

This graphic image below is a sample demonstration of connectivity between local host machine and remote device running the Docker container.

Reference image of connectivity between local desktop and Docker container running on remote device

Prerequisites

This requires MATLAB R2025a or higher.

Dockerfiles Shipped with ROS Toolbox

The ROS Toolbox provides three Dockerfiles for ROS 2 listed in this table below.

NamePathContent
baseros_jazzy/Ubuntu/base

ROS 2 Jazzy desktop installation

gazeboros_jazzy/Ubuntu/gazebo
PX4ros_jazzy/Ubuntu/px4_gazebo

Select the 'base' image for running ROS 2 examples that involve only code generation. Use the 'gazebo' image for examples requiring a Gazebo world, and choose the 'PX4' image for examples that involve both PX4® and Gazebo.

Additionally, the ROS Toolbox provides two Dockerfiles for ROS listed below.

NamePathContent
ubunturos_jazzy/Ubuntu
debianros_jazzy/Debian

Instructions for Platform-Based Docker Installation

 Windows (WSL)

 Linux (Ubuntu)

 Mac

Setup Instructions post Docker Installation

 Set Up Docker Shipped with ROS Toolbox

 Set Up Externally Sourced Docker

Run Docker Container

Note

This step is NOT relevant for running ROS Toolbox examples.

Run this command to set up Docker and test its deployment. It supports remote code generation workflow.

docker run -it --net=host --name <container-name> <image-name>

The preconfigured Docker shipped with ROS Toolbox also comes with the capability of displaying GUI applications. You can see the following instructions to display the GUI applications using VNX or Xserver.

 View GUI Application Using VNC

 View GUI Application Using Xserver

See Also

Topics

External Websites