This commit is contained in:
Andy 2016-05-07 10:38:37 +02:00
parent 02b7a5449a
commit 36535a3911
Signed by: arno
GPG Key ID: 368DDA2E9A471EAC
4 changed files with 60 additions and 58 deletions

View File

@ -1,42 +1,40 @@
# Run Chrome in a container # Run Chrome in a container
FROM debian:jessie FROM ubuntu:xenial
MAINTAINER Andrey Arapov <andrey.arapov@nixaid.com> MAINTAINER Andrey Arapov <andrey.arapov@nixaid.com>
# To avoid problems with Dialog and curses wizards # To avoid problems with Dialog and curses wizards
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
ENV USER chrome
ENV GROUPS video,audio
ENV UID 1000
ENV HOME /home/$USER
ADD https://dl.google.com/linux/direct/google-talkplugin_current_amd64.deb /tmp/google-talkplugin_current_amd64.deb ADD https://dl.google.com/linux/direct/google-talkplugin_current_amd64.deb /tmp/google-talkplugin_current_amd64.deb
ADD https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb /tmp/google-chrome-stable_current_amd64.deb ADD https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb /tmp/google-chrome-stable_current_amd64.deb
RUN sh -c 'dpkg -i /tmp/google-chrome-stable_current_amd64.deb \ RUN sh -c 'dpkg -i /tmp/google-chrome-stable_current_amd64.deb \
/tmp/google-talkplugin_current_amd64.deb 2>/dev/null; exit 0' \ /tmp/google-talkplugin_current_amd64.deb 2>/dev/null; exit 0' && \
&& apt-get update \ apt-get update && \
&& apt-get -fy install \ apt-get -fy install && \
&& apt-get install -y libcanberra-gtk-module libexif12 pulseaudio \ apt-get install -y libcanberra-gtk-module libexif12 pulseaudio && \
&& rm -rf -- /var/lib/apt/lists /tmp/*.deb rm -rf -- /var/lib/apt/lists /tmp/*.deb
RUN useradd -u $UID -m -d $HOME -s /usr/sbin/nologin $USER \ # Workaround: pulseaudio client library likes to remove /dev/shm/pulse-shm-*
&& usermod -aG $GROUPS $USER \ # files created by the host, causing sound to stop working.
&& su -s /bin/sh -l $USER -c 'mkdir -p $HOME/.pki/nssdb $HOME/.local' # To fix this, we either want to disable the shm or mount /dev/shm
# in read-only mode when starting the container.
RUN echo "enable-shm = no" >> /etc/pulse/client.conf
# if you don't want pulseaudio, uncomment the following lines ENV USER user
# COPY asoundrc /etc/asound.conf ENV GROUPS video,audio
# RUN chgrp audio /etc/asound.conf && chmod 0640 /etc/asound.conf ENV UID 1000
ENV HOME /home/$USER
# for some unknown reason the ownCloud's (v9.0.0) calendar (v1.0.0.0) doesn't RUN useradd -u $UID -m -d $HOME -s /usr/sbin/nologin -G $GROUPS $USER && \
# show up the calendars when the time is set to UTC/Zulu su -s /bin/sh -l $USER -c 'mkdir -p $HOME/.pki/nssdb $HOME/.local'
RUN echo "CET" > /etc/timezone \
&& dpkg-reconfigure tzdata
USER $USER USER $USER
WORKDIR $HOME
VOLUME [ "$HOME/.pki/nssdb", \ VOLUME [ "$HOME/.pki/nssdb", \
"$HOME/.local", \ "$HOME/.local", \
"/tmp" ] "/tmp", \
"/data" ]
ENTRYPOINT [ "/usr/bin/google-chrome" ] ENTRYPOINT [ "/usr/bin/google-chrome" ]
CMD [ "--user-data-dir=/data" ] CMD [ "--user-data-dir=/data" ]
# "--no-sandbox" ] # "--no-sandbox" ]

View File

@ -1,28 +1,34 @@
Readme # Google Chrome in Docker
======
First initialize the data volume
```
docker run --rm -ti -v chrome_data:/data busybox /bin/sh -c "chown 1000:1000 /data"
```
Launch the Chrome
Launching the Google Chrome
``` ```
docker-compose up -d docker-compose up -d
``` ```
Extra ## Extra Notes
=====
Good & stable vsync Good & stable vsync
``` ```
chrome://flags/ chrome://flags/
Enable "Override software rendering list" Enable "Override software rendering list"
``` ```
Note that /dev/shm should be mounted from host to the docker container.
Verify
Check
``` ```
chrome://gpu/ chrome://gpu/
``` ```
To see whether you have the best result, you should have stable 60 FPS at following tests To see whether you have the best result, you should have stable 60 FPS at following tests
``` ```
http://ie.microsoft.com/testdrive/Performance/FishIETank/Default.html http://ie.microsoft.com/testdrive/Performance/FishIETank/Default.html
http://www.vsynctester.com/ http://www.vsynctester.com/
@ -32,11 +38,13 @@ http://www.vsynctester.com/
You may want to disable Google's VP8 & VP9 video codecs: "MSE & WebM VP9" and "WebM VP8" You may want to disable Google's VP8 & VP9 video codecs: "MSE & WebM VP9" and "WebM VP8"
as there is no hardware decoding for them. as there is no hardware decoding for them.
To do this, install h264ify extension from To do this, install h264ify extension from
``` ```
https://chrome.google.com/webstore/detail/h264ify/aleakchihdccplidncghkekgioiakgal?hl=en-US https://chrome.google.com/webstore/detail/h264ify/aleakchihdccplidncghkekgioiakgal?hl=en-US
``` ```
Check the codecs Check the codecs
``` ```
https://www.youtube.com/html5 https://www.youtube.com/html5
``` ```

View File

@ -1,13 +0,0 @@
# To find your card
# aplay -l
# speaker-test -D plughw:CARD=PCH -l 1 -t sine
# defaults.pcm.!card PCH
# defaults.pcm.!device 0
# defaults.pcm.!ctl PCH
# defaults.pcm.card 1
# defaults.ctl.card 1
defaults.pcm.card plughw:PCH
defaults.ctl.card plughw:PCH

View File

@ -1,27 +1,36 @@
version: '2' version: '2'
# Initialize
# docker run --rm -ti -v chrome_data:/data busybox /bin/sh -c "chown 1000:1000 /data"
volumes:
data: {}
services: services:
chrome: chrome:
build: ./ image: andrey01/chrome
read_only: true read_only: true
networks: network_mode: bridge
- isolated
devices: devices:
- /dev/dri - /dev/dri
# - /dev/video0
volumes: volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:ro
- $XDG_RUNTIME_DIR/pulse:/run/user/1000/pulse
- /dev/shm:/dev/shm - /dev/shm:/dev/shm
- /tmp/.X11-unix:/tmp/.X11-unix - data:/data
- /tmp/krb5cc_1000:/tmp/krb5cc_1000:ro - $HOME/Downloads:/home/user/Downloads
- /var/run/cups:/var/run/cups:ro - /var/run/cups:/var/run/cups:ro
- $HOME/.config/google-chrome/:/data - /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:ro
- $HOME/Downloads:/home/chrome/Downloads # - /tmp/krb5cc_1000:/tmp/krb5cc_1000:ro
environment: environment:
DISPLAY: unix$DISPLAY - DISPLAY=unix$DISPLAY
PULSE_SERVER: tcp:pulseaudio:4713 - PULSE_SERVER=unix:$XDG_RUNTIME_DIR/pulse/native
cap_add: # for some unknown reason the ownCloud's (v9.0.0) calendar (v1.0.0.0) does work correctly,
- SYS_ADMIN - TZ=Europe/Amsterdam
# unless the timezone is set
networks: # security_opt:
isolated: # - apparmor:docker-ptrace
external: # - apparmor:unconfined
name: isolated # cap_add:
# - SYS_ADMIN