ROS environment in Docker with X11
Hi,
This seems to be a fairly complicated thing to do. I want to set up a docker ROS development environment with catkin I am running ubuntu focal as my base environment
I have downloaded the osrf/ros:noetic-desktop-full image and I have been able to successfully run this as a container and perform a catkin_make. I can build projects on it from a container command line
I think I am pretty close to being able to get vscode working on it as well.
however I have not been able to get X11 output on it. I have followed the examples here and here
the problems I am having is when I try and run the docker image and create the container I receive these errors:
docker run -dt --name robot_env --restart unless-stopped -v 'pwd':/root/workspace --device=/dev/dri --volume=/tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY osrf/ros:noetic-desktop-full
e41c569191ad1799917f27384025826b987951de46b12d64a7295d59892aa23c
docker: Error response from daemon: Mounts denied:
The path /tmp/.X11-unix is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
See https://docs.docker.com/ for more info.
and when I remove the volume to /tmp/.X11-unix and try, I receive this error
docker run -dt --name robot_env --restart unless-stopped -v 'pwd':/root/workspace --device=/dev/dri -e DISPLAY osrf/ros:noetic-desktop-full
8ed2a58fb0bdd6c76e9ee6d9022542011d06df24f10cf8a88a1edf1bb0f5a504
docker: Error response from daemon: error gathering device information while adding custom device "/dev/dri": no such file or directory.
Regrading the device issue, it may just be a case of not knowing what the device name is that I need to add
but the /tmp/.X11-unix problem seems like there is something missing on my install? Perhaps this is relevent to windows systems? Permissions? I'm not sure.
I checked and I do have a /tmp/.X11-unix folder so maybe it is permissions?
anyone know how to get X11 output working?
thanks in advance
Are you using focal desktop or server? And are you remotely connecting to the development computer, or direct? VM by any chance?
Have you tried running your command as sudo to see if it was permissions related ?
Both these tutorial start with "using rocker". Have you tried using it ? The following works for me:
rocker osrf/ros:noetic-desktop-full bash --x11
Hi, everything exists on the same machine running focal desktop clean install. I have installed build-essential and docker only. To connect to the docker container I use docker exec .. bin/bash.
To create the docker container I used the docker run command (without the X11 stuff.)
I believe vscode opens a remote "container" to it, but that's a different thing, and seems to be coincidental nomenclature.
At the moment I would be happy just to get glxgears working from a docker terminal.
(glxgears works fine locally as well.)
I'll give rocker a try now and see how I go, thanks.
ADE is another option to setup and run a Docker based dev environment with GUI support. There is also a vscode volume available that can be loaded alongside it.
@marguedas Thanks for this. I was able to install rocker and running your command got it to build the image, but it seems that it built the image in the default context.
I'll see whether I can get it to build it in the desktop-linux context, but it looks promising.