Last active
November 24, 2023 09:35
-
-
Save stuart-warren/efad034cfb6ca54457882410fb998d3b to your computer and use it in GitHub Desktop.
Start chrome with docker-compose (helps with aws greengrass iot core also)
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
version: "3.8" | |
services: | |
chrome: | |
network_mode: "host" | |
image: jess/chrome | |
environment: | |
DISPLAY: 'unix:0' | |
volumes: | |
- /run/dbus/system_bus_socket:/run/dbus/system_bus_socket | |
- /tmp/.X11-unix:/tmp/.X11-unix | |
- /etc/localtime:/etc/localtime:ro | |
- $HOME/Downloads:/root/Downloads | |
- $HOME/.config/google-chrome/:/data | |
- /dev/shm:/dev/shm | |
- /etc/hosts:/etc/hosts | |
devices: | |
- /dev/snd | |
- /dev/dri | |
- /dev/bus/usb | |
security_opt: | |
- seccomp:/etc/docker/seccomp/chrome.json | |
command: | |
- --user-data-dir=/data | |
- --kiosk | |
- https://google.com/search?q=foobar | |
restart: unless-stopped |
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
# install docker https://docs.docker.com/engine/install/ubuntu/ | |
# install docker-compose https://docs.docker.com/compose/install/ | |
sudo usermod -aG docker $USER | |
sudo mkdir -p /etc/docker/seccomp | |
sudo wget https://raw.githubusercontent.com/jfrazelle/dotfiles/master/etc/docker/seccomp/chrome.json -O /etc/docker/seccomp/chrome.json | |
export DISPLAY=:0 | |
xhost local:root | |
sudo chgrp $USER /run/dbus/system_bus_socket | |
mkdir -p ~/.config/google-chrome/ | |
chmod 777 ~/.config/google-chrome/ # container will run as uid 999 by default | |
docker run -it \ | |
--net host \ | |
--cpuset-cpus 0 \ | |
--memory 512mb \ | |
-e DISPLAY=unix$DISPLAY \ | |
-v /run/dbus/system_bus_socket:/run/dbus/system_bus_socket \ | |
-v /tmp/.X11-unix:/tmp/.X11-unix \ | |
-v /etc/localtime:/etc/localtime:ro \ | |
-v $HOME/Downloads:/root/Downloads \ | |
-v $HOME/.config/google-chrome/:/data \ | |
-v /dev/shm:/dev/shm \ | |
-v /etc/hosts:/etc/hosts \ | |
--device /dev/snd \ | |
--device /dev/dri \ | |
--device /dev/bus/usb \ | |
--group-add audio \ | |
--group-add video \ | |
--rm \ | |
--security-opt seccomp:/etc/docker/seccomp/chrome.json \ | |
jess/chrome --user-data-dir=/data https://google.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment