Skip to content

Instantly share code, notes, and snippets.

@weldpua2008
Created September 1, 2021 19:32
Show Gist options
  • Save weldpua2008/c280f8f2e8f3bc369f13ef1dc75dbdbd to your computer and use it in GitHub Desktop.
Save weldpua2008/c280f8f2e8f3bc369f13ef1dc75dbdbd to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
get_ip(){
ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}' |head -1
}
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
xhost +$(get_ip)
xhost + $(hostname)
docker run --rm -it ${VOLUMES} -e DISPLAY=$(ipconfig getifaddr en0):0.0 jess/firefox
#docker run -it --rm \
# --net host \
# --cpuset-cpus 0 \
# --memory 512mb \
# -v /tmp/.X11-unix:/tmp/.X11-unix \
# -e DISPLAY=unix$DISPLAY \
# -v $HOME/Downloads:/home/chrome/Downloads \
# -v $HOME/docker/chrome/.config/google-chrome/:/data \
# -v /dev/shm:/dev/shm \
# --name chrome \
# jess/chrome
docker run -it --rm \
--privileged \
--net host \
--cpuset-cpus 0 \
--cap-add SYS_ADMIN \
--device /dev/dri \
--memory 512mb \
-e DISPLAY=$(ipconfig getifaddr en0):0.0 \
-v $HOME/Downloads:/home/chrome/Downloads \
-v $HOME/docker/chrome/.config/google-chrome/:/data \
-v /dev/shm:/dev/shm \
--name chrome \
jess/chrome
docker run --rm -ti -e DISPLAY=docker.for.mac.host.internal:0 jamesnetherton/gimp
docker run -it \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
--name spotify \
jess/spotify
xhost +
docker run -it \
-v /tmp/.X11-unix:/tmp/.X11-unix \ # mount the X11 socket
-e DISPLAY=unix$DISPLAY \ # pass the display
--device /dev/snd \ # sound
--name spotify \
jess/spotify
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment