Skip to content

Instantly share code, notes, and snippets.

@sgarciav
Created June 9, 2021 23:37
Show Gist options
  • Save sgarciav/8636b50e37def33ae379c3ea3d5d30f7 to your computer and use it in GitHub Desktop.
Save sgarciav/8636b50e37def33ae379c3ea3d5d30f7 to your computer and use it in GitHub Desktop.
docker-compose file to run Rviz inside a Docker container
version: "3.4"
services:
ros-rviz:
build:
context: .
dockerfile: Dockerfile
image: rviz_container:melodic
container_name: rviz_test
network_mode: "host"
stdin_open: true # docker run -i
tty: true # docker run -t
privileged: true
runtime: nvidia
environment:
- DISPLAY=$DISPLAY
- QT_X11_NO_MITSHM=1
- XAUTHORITY=/tmp/.docker.xauth
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=all
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- /tmp/.docker.xauth:/tmp/.docker.xauth:rw
@sgarciav
Copy link
Author

sgarciav commented May 3, 2024

Make sure you have apt-get installed the nvidia-docker2 package.

Also, what's the output when you execute nvidia-smi?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment