Run GUI / GPU-accelerated ROS applications inside of Docker containers
This project provides docker images for ROS, along with optional NVIDIA acceleration support, with a friendly startup script and VSCode development support.
Example use cases:
Docker Hub: https://hub.docker.com/r/jaci/ros GitHub: https://github.com/JacisNonsense/docker-ros
cd /tmp
git clone https://github.com/JacisNonsense/docker-ros
cd docker-ros
rm -r ~/.docker-ros
cp -r shell/ ~/.docker-ros
.bashrc
/ .zshrc
to include the following linesexport UID=${UID}
export GID=${GID}
source ~/.docker-ros/ros.sh
# OPTIONAL: Isolate the default HOME for the docker container if you don't want to passthrough your own.
ROS_DOCKER_HOME=path/to/my/isolated/home
nvidia-docker2
if you have a NVIDIA GPU: nvidia-docker repo
$ ros <version>
Where <version>
is one of the following:
kinetic
, melodic
- Aliases to kinetic-desktop-full
and melodic-desktop-full
kinetic-ros-core
, kinetic-ros-base
, kinetic-robot
, kinetic-perception
, kinetic-desktop
, kinetic-desktop-full
melodic-ros-core
, melodic-ros-base
, melodic-robot
, melodic-perception
, melodic-desktop
, melodic-desktop-full
For example:
$ ros melodic
user@host:/work$
By default, the ros
script will automatically:
nvidia-docker2
runtime (you must install it first!)$HOME
/work
via docker bind mount-it --rm
)You can specify your own image with --image image
:
$ ros --image myname/myimage:version
You can launch a program directly from the ros script if you don't require a bash prompt:
$ ros melodic rviz
Install the Remote - Container
extension and copy the .devcontainer
folder into your VSCode workspace.
Open the command palette with CTRL + SHIFT + P
and select Remote-Containers: Reopen Folder in Container
. VSCode will build a new container and open the editor within the context of the container, providing C++ and Python intellisense with the ros installation.
By default, the VSCode containers do not forward X11 nor run on the NVIDIA docker runtime. If you require GUI applications and/or NVIDIA acceleration, launch with ros <version>
in a terminal (as seen in the 'Running' section above).