Reputation: 213
I have a QT based GUI application which i compiled in docker (centos image). I am able to launch GUI application from inside Centos image in my Linux machine(OpenSUSE 13.2) Following instruction from this blog "http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker"
Same thing i want to do via window.I installed window docker . I loaded the desired centos images having my GUI application and and through terminal trying to launch GUI by using container . It gives Error saying" gui: cannot connect to X server"
Any idea or solution .
Upvotes: 5
Views: 4720
Reputation: 786
This solution based on a blog article from Robin Kretzschmar. I tested it with the following Dockerfile.
FROM ubuntu:22.10
RUN apt-get update
RUN apt-get install -y kate
CMD kate
The container is build with
docker build . -t test/kate
On your Windows Host you need to install a x-server, I used VcSrv. After you started VcSrv, you can run
docker run -ti --rm -e DISPLAY=host.docker.internal:0.0 test/kate
and an instance of kate is shown
Upvotes: 0
Reputation: 1324278
There was a similar discussion on docker issue 8710, but for MacOS:
A somewhat crude way to do this:
Start
socat
to expose localxquartz
socket on a TCP port
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
(Note: for Windows, you would need at least:
socat
is available for Windows
)Pass the display to container (assuming virtualbox host is available on 192.168.59.3):
docker run -e DISPLAY=192.168.59.3:0 jess/geary
(This is insecure on public networks, add
bind
,su
andrange
options to socat to limit access.)
Upvotes: 3