Can you run GUI applications in a Linux Docker container?
You can simply install a vncserver along with Firefox :)
I pushed an image, vnc/firefox, here: docker pull creack/firefox-vnc
The image has been made with this Dockerfile:
# Firefox over VNC
#
# VERSION 0.1
# DOCKER-VERSION 0.2
FROM ubuntu:12.04
# Make sure the package repository is up to date
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
# Install vnc, xvfb in order to create a 'fake' display and firefox
RUN apt-get install -y x11vnc xvfb firefox
RUN mkdir ~/.vnc
# Setup a password
RUN x11vnc -storepasswd 1234 ~/.vnc/passwd
# Autostart firefox (might not be the best way to do it, but it does the trick)
RUN bash -c 'echo "firefox" >> /.bashrc'
This will create a Docker container running VNC with the password 1234
:
For Docker version 18 or newer:
docker run -p 5900:5900 -e HOME=/ creack/firefox-vnc x11vnc -forever -usepw -create
For Docker version 1.3 or newer:
docker run -p 5900 -e HOME=/ creack/firefox-vnc x11vnc -forever -usepw -create
For Docker before version 1.3:
docker run -p 5900 creack/firefox-vnc x11vnc -forever -usepw -create
Unable to display GUI application from Windows container : Windows 2019 Server
The short answer here is no. Windows containers don't have the underlying GUI components available, so you can't run any desktop application on Windows containers.
The longer answer is that this depends on what you're trying to achieve. The actual components for the GUI (GUI APIs) are present on the Server Core and Server image (not on the Nano Server one). However, the GUI itself is not present. What that means is you can run an application that depends on the GUI APIs, for UI test automation, for example. I blogged about this topic a while ago here: https://techcommunity.microsoft.com/t5/containers/nano-server-x-server-core-x-server-which-base-image-is-the-right/ba-p/2835785
How to run GUI application from linux container in Window using Docker?
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:
- an X11 server like Xming
- to check if
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.)
Is it possible to run a docker container embedding a GUI environment on a GUI-less server and open the GUI session from a remote GUI client?
I found this docker image which solves my question : docker-x2go-xubuntu :
https://hub.docker.com/r/paimpozhil/docker-x2go-xubuntu
I built it on the GUI-less server and ran it as explained on docker hub.
On my second computer I opened an ssh tunnel to the GUIless server pointing to the docker interface :
ssh -CY -L 33333:container.docker.ip:2222 -l guilessuserlogin guiless.server.ip
(I retrieved the container IP by ifconfig on the GUIless server)
On this second computer I installed x2goclient from the regular repositories and configured a session to connect to localhost:33333
Once connected, the GUI desktop of the docker machine is completely available.
Run GUI app in linux docker on linux server on windows host
It turns out this way: i need to install these packages inside my container under root:
apt-get install libxrender1 libxtst6 libxi6
So now i have pycharm displayed and it's interacting well.
The main tip was written and described there
Related Topics
How to Send a HTML Email With the Bash Command "Sendmail"
Save Modifications in Place With Awk
Can't Call C Standard Library Function on 64-Bit Linux from Assembly (Yasm) Code
How to Get the Total Cpu Usage of an Application from /Proc/Pid/Stat
Bash Script Processing Limited Number of Commands in Parallel
Forward Host Port to Docker Container
How to Deal With a Filename That Starts With the Hyphen (-) Character
Find -Exec' a Shell Function in Linux
Pipe Only Stderr Through a Filter
Print a File, Skipping the First X Lines, in Bash
Why Should Eval Be Avoided in Bash, and What Should I Use Instead
How to Change Permissions For a Folder and Its Subfolders/Files
How to Automatically Redirect Http to Https on Apache Servers
How Many Socket Connections Possible
Linking Against an Old Version of Libc to Provide Greater Application Coverage