Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running GUI apps on docker container with a MacBookPro host

I have been trying to follow the instructions on https://learning-continuous-deployment.github.io/docker/images/dockerfile/2015/04/22/docker-gui-osx/ about running GUI apps in a docker container inside a MacBookPro host (using Docker tools).

I created a simple docker container using Fedora 23 and with firefox installed.

I try to run firefox and after about a minute I get the following error:

Unable to init server: Broadway display type not supported: 192.168.57.3:0
Error: cannot open display: 192.168.57.3:0

Does anyone have a clue what the error means and/or how to fix it?

like image 903
emory Avatar asked May 30 '16 10:05

emory


People also ask

Can I run GUI apps in a docker container?

This allows your container to use the X Server you already have. GUI applications running in the container would then appear on your existing desktop. Why Run GUI Apps in Docker? Running a GUI program in Docker can be a useful technique when you’re evaluating a new piece of software.

Did You Know you can run Docker on Mac OS X?

But did you know that you can just as well run applications with a graphical user interfaces, like Chrome, Firefox, Tor Browser, Gimp, etc… with Docker… on OS X! This article serves as transcript to our hands-on demo and as a quick refresher on how to run these kind of applications on a Mac in 5 minutes or less.

How long does it take to run an application in Docker?

Also if you has the pre-configured Docker Image then you can launch your entire OS with the running server in it in just few seconds. Container is like an isolated environment to run your application.

How do I run a docker container from an image?

The “ commit” command is used to create an image from your running container. To run a new docker container from your created os image in which you already install some GUI applications and env displays the environment that it received from its parent (base os), and set image name and version as you mentioned in the previous command.


1 Answers

On a Mac you may find the following steps useful:

  1. Install XQuartz
  2. Open it, goto preferences > Security and check the option to allow connections from network clients
  3. Reboot
  4. Start XQuartz (from the applications folder or with open -a XQuartz)
  5. Allow incoming connections from your ip with xhost + $IP (see note 1)
  6. Run firefox in your docker container (see note 2)

Note 1: Here's a neat trick toget your ip address:

export IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}') 

Note 2: And an example docker run command to start firefox

docker run -it -e DISPLAY=$IP:0 -v /tmp/.X11-unix:/tmp/.X11-unix <image> firefox
like image 162
Adam Griffiths Avatar answered Sep 20 '22 06:09

Adam Griffiths