Skip to content

Instantly share code, notes, and snippets.

@kgust
Last active March 30, 2017 03:14
Show Gist options
  • Save kgust/f151d3a54488b3c137c145966bb92b39 to your computer and use it in GitHub Desktop.
Save kgust/f151d3a54488b3c137c145966bb92b39 to your computer and use it in GitHub Desktop.
How to run a GUI app inside Docker and display on macOS...

A somewhat crude way to do this:

Start socat to expose local xquartz socket on a TCP port
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"

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 and range options to socat to limit access.)

From: moby/moby#8710


@ikabar-tracxpoint I had the same problem as you and i made it work as follow:

Close xQuartz.

IN a normal terminal, run as follow:

socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:"$DISPLAY"

You can put it in a screen session Still in a normal terminal, enter:

docker run -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=:0 jess/firefox It take time to boot xquartx, and voila, it should work fine

Good luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment