Sign inSign up

diegoferigo/ros

By diegoferigo

Updated over 7 years ago

ROS lunar-desktop-full image with runtime user creation and X11 forwarding support

Image
1

3.3K

diegoferigo/ros repository overview

Dockerfile for ROS melodic desktop-full.

Features:

  • X11 authentication for GUIs
  • Image size: 2.9 GB
  • User created during runtime
  • Nvidia GPU and OpenGL support

Build the image

Intel GPU
docker build --rm --pull -t diegoferigo/ros .
Nvidia GPU
docker build --rm --pull --build-arg from=nvidia/opengl:1.0-glvnd-runtime-ubuntu18.04 -t diegoferigo/ros:nvidia .

User configuration

Several reasons could be found for having a non-root user within the container that matches the GID and UID of your host user.

This docker image allows the creation of a runtime user, whose default UID and GID is 1000. To override these values and to start the container, execute:

docker run -i -t --rm \
	-e USER_UID=$(id -u) \
	-e USER_GID=$(id -g) \
	-e USERNAME=$(whoami) \
	--name ros \
	diegoferigo/ros \
	bash

Then, create as many ttys as needed with

docker exec -it ros bash

The image does not contain sudo and the root password is not set. When the active user is not root, to execute commands that require admin privileges you should open a new tty or use exit on the current shell getting back to the root user.

X11 authentication

As an example, rqt is forwarded from within the container to the host's Xserver:

XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth

touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -

docker run -i -t --rm \
	-v $XSOCK:$XSOCK:rw \
	-v $XAUTH:$XAUTH:rw \
	-e XAUTHORITY=${XAUTH} \
	-e DISPLAY \
	-e USER_UID=$(id -u) \
	-e USER_GID=$(id -g) \
	-e USERNAME=$(whoami) \
	--name ros \
	diegoferigo/ros \
	rqt

If you need HW acceleration (only for Intel graphic cards), add also this device flag --device=/dev/dri.

For what concerns Nvidia GPUs, you need to configure and install nvidia-docker. With such setup, you only have to:

  1. Add the additional option --runtime nvidia
  2. Use the diegoferigo/ros:nvidia image

Resources

TODO

Tag summary

Content type

Image

Digest

Size

913.1 MB

Last updated

over 7 years ago

docker pull diegoferigo/ros