System: Ubuntu 16.04
Display-Manager: lightdm

I'm trying to create a docker container FROM ubuntu:latest where a GUI-Application is running in. The application needs to get executed with sudo to access the inside used commands. I followed the instruction of this Blog and adapted it for my use.

After i build this container I first ran it with:

docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix repo-test-3 /bin/bash



and the application is shown at the screen.

The next I tried to run the same container with -u 0 to become root and after i tried to start the application the following error message appears:

No protocol specified
QXcbConnection: Could not connect to display :0
Aborted (core dumped)

Do you have any idea whats the problem and how I can fix this?


The solution is:

Give docker the rights to access the X-Server with:

xhost +local:docker
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.