Docker Community Forums

Share and learn in the Docker community.

Start a GUI-Application as root in a Ubuntu Container

docker

(Daniel0eis) #1

Hello Community,

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
then
./applicatin
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?

Best regards,
Daniel E.

EDIT:
The Solution of the problem:

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

xhost +local:docker


(123why) #2

Thanks.You help me a lot,and just use the commad ‘xhost +local:docker’ on the localhost machine.