osrf / rocker

A tool to run docker containers with overlays and convenient options for things like GUIs etc.
Apache License 2.0
559 stars 73 forks source link

--nocleanup argument unable to run rviz2 after re-entering container #170

Closed MrOCW closed 2 years ago

MrOCW commented 2 years ago

Hi,

I ran rocker --nocleanup --nvidia --x11 --privileged --network host --volume xxxxx -- osrf/ros:galactic-desktop and rviz2 works but after exiting, running docker start <container_id> gives me Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/tmp/.dockercfa2413r.xauth" to rootfs at "/tmp/.dockercfa2413r.xauth" caused: mount through procfd: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type Error: failed to start containers: <container_id>

running docker run -it --network host --gpus all --privileged -v xxxxxx -e DISPLAY -e TERM -e QT_X11_NO_MITSHM=1 -e XAUTHORITY=/tmp/.dockercfa2413r.xauth -v /tmp/.dockercfa2413r.xauth:/tmp/.dockercfa2413r.xauth -v /tmp/.X11-unix:/tmp/.X11-unix -v /etc/localtime:/etc/localtime:ro <image_id> enters a new container and rviz2 gives me:

No protocol specified
qt.qpa.xcb: could not connect to display :1
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
tfoote commented 2 years ago

Reentry isn't something that I've tested.

The xauthority file is a temporary file created speficificailly for this launch and gets cleaned up by rocker at the end. So when you try to restart the container it tries to remount the file that doesn't exist. I think that the temporary xauth file needs to be persisted if the --nocleanup option is used.

I confirmed this seems to fix the problem by recreating the xauth file manually then I was able to restart the container.

felixf4xu commented 6 months ago

this seems to fix the problem by recreating the xauth file manually

Could you share how to recreate the /tmp/.dockercfa2413r.xauth file (or folder) manually?