This repository provides Dockerfiles and a convenient Makefile to build and manage Docker containers tailored for ROS (Robot Operating System) and ROS2 development with NVIDIA GPU and CUDA support.
Supported ROS distributions:
- ROS:
melodic
,noetic
- ROS2:
foxy
,humble
- NVIDIA GPU & CUDA support via NVIDIA Container Toolkit
- X11 GUI forwarding to host
- Serial communication support
- Video input access
- Host networking
- Mounted volumes for
ros_ws/src
anddata
for persistent development
Make sure you have the following installed on your system:
Initially, you need to build the Docker image with the desired ROS distribution.**
To build the image, run the following command:
make build ROS_DISTRO=<ros_distro> USER_NAME=<user_name>
ROS_DISTRO
:melodic
,noetic
,foxy
orhumble
. Default ishumble
.USER_NAME
: Name of the user to be created in the container. Default isuser
.
- The command will prompt for the password for container user. It is optional and can be left empty.
- UID and GID match the host user to avoid permission issues.
- The above command will build the image with the tag
ros-<ros_distro>-image
.
After building the image, you can manage the container using the following commands.
Note: Use the same ROS_DISTRO and USER_NAME as when building the image.
To run the container, run the following command:
make run ROS_DISTRO=<ros_distro> USER_NAME=<user_name>
- The above command will create a container with the tag
ros-<ros_distro>-container
. - The container will be started and attached to the terminal and will not be stopped or removed when the terminal is closed.
To attach to the container, run the following command:
make attach ROS_DISTRO=<ros_distro>
To open a shell in the container, run the following command:
make exec ROS_DISTRO=<ros_distro>
To stop the container, run the following command:
make stop ROS_DISTRO=<ros_distro>
To start the container, run the following command:
make start ROS_DISTRO=<ros_distro>
To rebuild the image, run the following command:
make rebuild ROS_DISTRO=<ros_distro>
To remove the container and image, run the following command:
make clean ROS_DISTRO=<ros_distro>