Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows 10 Docker Host - Display GUI application from Linux Container

Tags:

I'm trying to use Windows 10 as my host and run Docker containers that contain gui based applications and display them using X11 forwarding or something similar. Pretty much all of the information I've found online deal with Linux Host to Linux Container (example - http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker) where the socket / x11 authority are exposed. Other information I've found is from previous implementations of Boot2Docker / Windows where virtualbox was required as part of the setup procedure and required VNC.

Basic setup currently, does anyone know what has to be adjusted to get Firefox to display within a window on the host system? --

Start an XMing server on Windows 10 host

Dockerfile

FROM ubuntu:14.04
RUN apt-get update && apt-get install -y firefox
CMD /usr/bin/firefox

Commands

PS> docker build -t firefox .
PS> set-variable -name DISPLAY -value localhost:0.0
PS> docker run -ti --rm -e DISPLAY=$DISPLAY firefox

Thanks

like image 227
Fitz Avatar asked Oct 13 '16 15:10

Fitz


People also ask

Can you run GUI applications in a Docker container?

Follow the below steps to run a GUI application inside Docker: Step 1: Install and Start Docker and check the status and restart the service. The Systemctl commands are used to manage system services. systemctl start docker // to start the docker service.

How do I connect to a Docker container GUI?

To connect to the server, you'll need a VNC client on your host. Find the IP address of your container by running docker ps , noting down the container ID and passing it to docker inspect <container> . You'll find the IP address near the bottom of the output, within the Network node.

Can Docker run Linux apps on Windows?

You can run both Linux and Windows programs and executables in Docker containers. The Docker platform runs natively on Linux (on x86-64, ARM and many other CPU architectures) and on Windows (x86-64). Docker Inc. builds products that let you build and run containers on Linux, Windows and macOS.


1 Answers

You'll need to set DISPLAY to something other than localhost. The container has its own localhost interface, so your X11 client will attempt to connect to itself instead of to your host.

Instead, you can pass in an IP address of your windows machine's network adapter. The container will be able to connect to that. You'll also need to have your X11 server configured to listen on that interface.

like image 69
programmerq Avatar answered Sep 27 '22 20:09

programmerq