Skip to content

Instantly share code, notes, and snippets.

@anton-matosov
Forked from jnovack/README.md
Created April 25, 2019 05:43
Show Gist options
  • Save anton-matosov/e802ee335d9a498cf92d77a91d965d87 to your computer and use it in GitHub Desktop.
Save anton-matosov/e802ee335d9a498cf92d77a91d965d87 to your computer and use it in GitHub Desktop.
Using Linux Display on OSX in docker

Installation

  1. Install docker
  2. Install socat (see install.sh)
  3. Install XQuartz from https://www.xquartz.org

Running

  1. Obtain your VirtualBox host IP Address. This is NOT the VirtualBox VM IP Address.

    $ VBOXNET=$(ifconfig vboxnet0 | grep inet | awk '{ print $2}')

  2. Run XQuartz. (You may close the terminal)

  3. Forward your display (socat MAY NOT fork() properly)

    $ socat TCP-LISTEN:6000,bind=${VBOXNET},reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"

  4. Run your Linux GUI docker container (in a new window if socat does not fork())

    $ docker run -it --rm -e DISPLAY=${VBOXNET}:0 chrisdaish/firefox

References

#!/bin/sh
# socat v1.7.3.0 is the last version to work on OSX 10.11.5.
cd /tmp
curl -LO http://www.dest-unreach.org/socat/download/socat-1.7.3.0.tar.bz2
tar -xjvf socat-1.7.3.0.tar.bz2
cd socat-1.7.3.0/
sudo ./configure && sudo make && sudo make install
cd ~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment