Skip to content

Instantly share code, notes, and snippets.

@zerob13
Forked from netgusto/README.md
Created May 10, 2016 02:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zerob13/987426d3e4a414a5eaba3e8fd49c8444 to your computer and use it in GitHub Desktop.
Save zerob13/987426d3e4a414a5eaba3e8fd49c8444 to your computer and use it in GitHub Desktop.
Run a graphical app in docker on OSX

Run a graphical app in docker on OSX

Note: Replace 192.168.0.5 below by your own interface ip

mac $ socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
mac $ docker run --device=/dev/tty0 -e DISPLAY=192.168.0.5:0 -i -t ubuntu /bin/bash
ubuntu $ apt-get update && apt-get install -y firefox
ubuntu $ firefox

If socat is not installed on your mac, install it with brew: brew install socat.

If XQuartz is not installed on your mac : https://www.xquartz.org/

If you get "Couldn't open libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory" while running the program (here, firefox) : apt-get install -y libglu1-mesa

Solution is not secure (publishes a TCP port linking to your X11 display socket).

Extracted from: moby/moby#8710

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