Saturday, September 23, 2017

16.04 - Start GUI-Application in Docker Container with sudo



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


then



./application



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

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...