Created
February 22, 2019 09:35
-
-
Save haochunchang/3bd743ff55afbdac8fc8574373085a7d to your computer and use it in GitHub Desktop.
Display GUI applications running in docker (tested in MacOS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Display GUI applications running in docker (tested in MacOS) | |
LOCAL_DIR=$1 | |
DOCKER_DIR=$2 | |
DOCKER_IMAGE=$3 | |
IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}') && echo $IP | |
xhost + $IP | |
docker run -it --name display -e DISPLAY=$IP:0 -v /tmp/.X11-unix:/tmp/.X11-unix -v $LOCAL_DIR:$DOCKER_DIR $DOCKER_IMAGE bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment