How to run a GUI application on docker

The OS is windows server 2016 about my computer, and how to run a GUI application on docker?
I found some infomation about Linux but no windows server 2016
Can anyone give some help? Thanks advance

3 Likes

You mean GUI inside container itself? it’s impossible since there is no RDP allowed into container.

Nonsense, why is RDP relevant. It’s perfectly possible to run a gui application inside a container.

How are you going to run GUI application from command line? What is the point?

I not commenting on whether what the OP wants to do has a point or not (I think it’s reasonable to assume that they have a relevant use case or why would they take the trouble of posting a question), what I am questioning is your assertion that this isn’t possible and the reason you have why you think that is so.

Care to explain why you are so sure its impossible ?

2 Likes

I guess it might be possible to run GUI based application in console, just no way to actually see the UI and there is no clean way to interact to this UI or automate it. For example if you launch notepad.exe from command line, what comes next after that?
I’m making assumption here but original poster did not work with containers before and confusing containers with real OS and wondering how he can do the same things which he used to do in real VM just this time inside container. Some of those relying on UI based installations or administration tasks. I got this asked frequently from people new to containers. And those tasks are in fact IMPOSSIBLE to do in windows containers. You can not launch UI based installation applications which require input for example in UI.

1 Like

yes,you are right, thank you for the reply.
We can run any application in Docker as long as it can be installed and executed unattended, although we can not see the GUI

So as per above discussion we can’t installed any application which need gui during installation time right ?

Yes, you can not install anything which requires any input inside UI. Majority of installation packages provides no UI option (like MSI installs etc)

It’s not entirely impossible. There’s no reason you can’t install e.g. tiger vncserver in your container, and then use vncviewer for the display.

3 Likes

Just posting because I am interested in this. A huge use-case is for automated UI testing using Selenium. We use docker containers to test firefox and chrome (on linux), but we would like to test Edge or IE as well.

How do you run UI based tests inside docker on Linux?

It uses xvfb . Here are the official containers, https://github.com/SeleniumHQ/docker-selenium , but there are many more from other people.

WindwosServerCore image does not come with binaries for UI applications so I doubt this will ever work in servercore image but Microsoft insiders can use new bigger WindwosServer image which I beleive have those libraries intact, while access via UI still missing (RDP is not working) I would guess it might be possible to use automated tools now.

From here https://hub.docker.com/u/microsoft/ , I see windowsservercore and also nanoserver. I assume windows server core is the old one? but nanoserver I think comes with even less ? Is there a “WindowsServer” image I am missing?

It’s not in docker hub yet. Details are here

https://blogs.technet.microsoft.com/virtualization/2018/06/27/insider-preview-windows-container-image/

Thank you ! I hope to experiment with it this weekend !

It is possible to run GUI applications in Linux containers on Windows host.
Have a look at:


x11docker can run in MSYS2, Cygwin/X or WSL on Windows.
Windows support is in master branch only and will be part of upcoming x11docker release 5.0.0.
It needs X server VcXsrv or Xwin in Cygwin/X.

How can u run GUI applications in docker window containers?

I’ve been running UI applications in docker containers on Linux for the past couple of years.

I figured it was only a matter of time before Microsoft caught up.

In the off chance that people arrive here wanting a solution for linux, this is what I paste into my Linux dockerfile to get a UI application working on Ubuntu:

# Create the GUI User
###############################################################################
ENV USERNAME guiuser
RUN useradd -m $USERNAME && \
    echo "$USERNAME:$USERNAME" | chpasswd && \
    usermod --shell /bin/bash $USERNAME && \
    usermod -aG sudo $USERNAME && \
    echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$USERNAME && \
    chmod 0440 /etc/sudoers.d/$USERNAME && \
    # Replace 1000 with your user/group id
    usermod  --uid 1000 $USERNAME && \
    groupmod --gid 1000 $USERNAME
# To run a GUI application, you need to do it from this user! From root type `su guiuser`.