Skip to content

Instantly share code, notes, and snippets.

@dqminh
Created July 29, 2021 20:14
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 dqminh/b886b0f764a2f8863ad69d677993dca0 to your computer and use it in GitHub Desktop.
Save dqminh/b886b0f764a2f8863ad69d677993dca0 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Run Chrome in a container
runtime=$1
ARGS="--net host"
if [ -z $runtime ]; then
ARGS="${ARGS}"
else
echo "running with $runtime"
shift
ARGS="${ARGS} --runtime $runtime"
fi
if [ ! -f "$HOME/chrome.json" ]; then
wget https://raw.githubusercontent.com/jfrazelle/dotfiles/master/etc/docker/seccomp/chrome.json -O ~/chrome.json
fi
xhost +local:chrome
docker run -it --rm \
$ARGS \
--memory 2048mb \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/Downloads:/home/chrome/Downloads \
-e DISPLAY=unix$DISPLAY \
--security-opt seccomp=$HOME/chrome.json \
--device /dev/snd \
--device /dev/dri \
--name chrome \
--hostname chrome \
jess/chrome "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment