First commit
This commit is contained in:
commit
fd6157d960
21
Dockerfile
Normal file
21
Dockerfile
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Use the latest alpine ISO
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Copy the static xcookie file and add the start-firefox.sh script
|
||||||
|
COPY xcookie /tmp/
|
||||||
|
ADD start-chromium.sh /
|
||||||
|
RUN chmod u+x /start-chromium.sh
|
||||||
|
|
||||||
|
# Add the necessary packages
|
||||||
|
RUN apk add alsa-utils xauth chromium
|
||||||
|
|
||||||
|
# Create a user and group firefox. Add the user to groups firefox; audio; video.
|
||||||
|
RUN adduser chromium -D ; addgroup chromium chromium ; addgroup chromium audio ; addgroup chromium video
|
||||||
|
|
||||||
|
# Create the asoundrc on the newly created user and insert the X11 cookie
|
||||||
|
RUN su -c 'echo -e "defaults.pcm.card 1;\ndefaults.pcm.device 0;\ndefaults.ctl.card 1;" > ~/.asoundrc' chromium
|
||||||
|
RUN su -c "xauth add $(cat /tmp/xcookie)" chromium
|
||||||
|
|
||||||
|
# Start the thingz
|
||||||
|
CMD [ "/bin/sh", "/start-chromium.sh" ]
|
||||||
|
|
||||||
29
README.txt
Normal file
29
README.txt
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# 0) This setup is intended for Desktop use by your local user and not root.
|
||||||
|
# It will spawn a docker container that will use your Xsession to run the chromium browser
|
||||||
|
# Your user is assumed to have permission to run and build containers
|
||||||
|
|
||||||
|
# 1) Go into the source directory of this app 'chromium' and copy it into your docker environment:
|
||||||
|
# You can use your own path but will need to adjust the below lines and any affected dependant files accordingly
|
||||||
|
$ cp . /var/lib/docker/configs/chromium/
|
||||||
|
$ cd /var/lib/docker/configs/chromium/
|
||||||
|
|
||||||
|
# 2) Configure the host environment for the container before starting it
|
||||||
|
# Run 'xauth list' on the Docker host as the user that will run the container (not root, unless root runs X on your system)
|
||||||
|
# Copy the whole line that was produced by the above command and save it into the xcookie in the source directory of this app
|
||||||
|
|
||||||
|
# 3) Build your container
|
||||||
|
$ docker build -t . chromium
|
||||||
|
|
||||||
|
# 4) Create the below directories within /var/lib/docker/configs/pass/data
|
||||||
|
# If using a different path to store your containers configurations and data files you will need to modify the paths in the 'firefox-container' script too
|
||||||
|
$ mkdir -p /var/lib/docker/configs/pass/data/{cache,config,pki}
|
||||||
|
# Create a directory to keep the downloads of your container locally:
|
||||||
|
$ mkdir -p /home/$USER/Downloads/chromium-container
|
||||||
|
|
||||||
|
# 5) Start your container with:
|
||||||
|
$ chromium-container
|
||||||
|
|
||||||
|
# 6) Optionally you can move the start-pass script somewhere inside of your path
|
||||||
|
$ sudo cp chromium-container /usr/loca/bin
|
||||||
|
$ sudo chmod -v 0755 /usr/loca/bin/chromium-container
|
||||||
|
|
||||||
13
chromium-container
Normal file
13
chromium-container
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
docker run --rm -it --privileged \
|
||||||
|
--net=host \
|
||||||
|
--memory "2048m"
|
||||||
|
--cpus "1"
|
||||||
|
-v /tmp/.X11-unix \
|
||||||
|
-v /home/$USER/Downloads/chrome-container/:/home/chrome/Downloads \
|
||||||
|
-v /var/lib/docker/configs/chrome/data/cache:/home/chrome/.cache \
|
||||||
|
-v /var/lib/docker/configs/chrome/data/config:/home/chrome/.config \
|
||||||
|
-v /var/lib/docker/configs/chrome/data/pki:/home/chrome/.pki \
|
||||||
|
-e DISPLAY=$DISPLAY \
|
||||||
|
--device=/dev/snd \
|
||||||
|
chromium
|
||||||
|
|
||||||
4
start-chromium.sh
Normal file
4
start-chromium.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
chgrp -R audio /dev/snd
|
||||||
|
su -c "chromium-browser --disable-dev-shm-usage" chromium
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user