There's WineHQ to run Windows applications on Linux (and macOS). But, what about other way around? What if you want to run Linux applications on Windows (and Mac). Docker is the answer but it if you think that Docker only can run terminal applications then you're wrong.

Q: Why would you like to run GUI applications inside Docker?

A: Bad question. I don't know. This tutorial is not about the reason. It could be any reason.

Q: How can you run GUI applications inside a Docker container on Windows, Linux and Mac hosts?

A: Good question. I know the answer.

I am using a simple Docker image that I have created and uploaded into DockerHub. You can use it directly or make your own. It's as simple as this:

FROM ubuntu:14.04

RUN apt-get update
RUN apt-get -y install firefox

CMD ["firefox"]

For Windows

  • Install  VcXsrv Windows X Server using the address below

  • Install & start XLaunch with usual Windows setup (a.k.a. next next) until you get to Extra Settings. Check all options as below and finish configuration. It's important to disable access control. Otherwise, the request from Docker will be rejected.
  • Get your IP address using ipconfig command (My IP address was yours might be different)
  • Run Firefox GUI as below
docker run --rm -it -e DISPLAY= aliustaoglu/firefox

This will create a container and from this container Firefox will run. When you finish with it, the container will be removed (--rm)

Quite easy

For Mac

For macOS we need to install xQuartz. You can use brew:

brew cask install xQuartz

Or download the dmg file:

After installing xQuartz, run it and check the option "Allow connections from network clients". Keep xQuarts running.

Now find your local IP address using ifconfig or any other method you know. My address was And run bellow command:

xhost +

Now we are ready to run the docker image:

docker run --rm -e DISPLAY= -v /tmp/.X11-unix:/tmp/.X11-unix aliustaoglu/firefox

For Linux

X11 (X Windows System) is the GUI environment in Unix operating systems. Since it's a native Linux platform we don't need to install xQuartz or XLaunch as Linux already has it. We only need to run this command:

docker run --rm -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix aliustaoglu/firefox