This repository contains Dockerfiles and a Makefile to build a Docker container for developing ROS applications. The supported ROS versions are Noetic and Humble. The container features the following:
- Mounts ros_ws/src and data directories as volumes
- Forwards X11 display to the host
- Supports serial communication
- Supports video input
- Allows access to the host's network
To build the container, run the following command:
make build ROS_DISTRO=<ros_distro> USER_NAME=<user_name>
<ros_distro>
is the ROS distro to be used in the container. Supported distros aremelodic
,noetic
,foxy
, andhumble
. Default isnoetic
.<user_name>
is the name of the user to be created in the container. Default isuser
.
- The command will prompt for the password for the user to be created in the container. It is optional and can be left empty.
- The user will be created with the same user id and group id as the host user. This is to avoid permission issues for X11 display and mounted volumes.
- The above command will build the image with the tag
ros-<ros_distro>-image
.
After a Docker image with a specific ROS distro is built, the following commands can be used to manage the image and the container. Note: The arguments used in the following commands should be the same as the ones used to build the corresponding 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. The container 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>