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
FROM debian:jessie
FROM ubuntu:xenial
MAINTAINER Andrey Arapov <andrey.arapov@nixaid.com>
# To avoid problems with Dialog and curses wizards
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-chrome-stable_current_amd64.deb /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' \
&& apt-get update \
&& apt-get -fy install \
&& apt-get install -y libcanberra-gtk-module libexif12 pulseaudio \
&& rm -rf -- /var/lib/apt/lists /tmp/*.deb
/tmp/google-talkplugin_current_amd64.deb 2>/dev/null; exit 0' && \
apt-get update && \
apt-get -fy install && \
apt-get install -y libcanberra-gtk-module libexif12 pulseaudio && \
rm -rf -- /var/lib/apt/lists /tmp/*.deb
RUN useradd -u $UID -m -d $HOME -s /usr/sbin/nologin $USER \
&& usermod -aG $GROUPS $USER \
&& su -s /bin/sh -l $USER -c 'mkdir -p $HOME/.pki/nssdb $HOME/.local'
# Workaround: pulseaudio client library likes to remove /dev/shm/pulse-shm-*
# files created by the host, causing sound to stop working.
# 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
# COPY asoundrc /etc/asound.conf
# RUN chgrp audio /etc/asound.conf && chmod 0640 /etc/asound.conf
ENV USER user
ENV GROUPS video,audio
ENV UID 1000
ENV HOME /home/$USER
# for some unknown reason the ownCloud's (v9.0.0) calendar (v1.0.0.0) doesn't
# show up the calendars when the time is set to UTC/Zulu
RUN echo "CET" > /etc/timezone \
&& dpkg-reconfigure tzdata
RUN useradd -u $UID -m -d $HOME -s /usr/sbin/nologin -G $GROUPS $USER && \
su -s /bin/sh -l $USER -c 'mkdir -p $HOME/.pki/nssdb $HOME/.local'
USER $USER
WORKDIR $HOME
VOLUME [ "$HOME/.pki/nssdb", \
"$HOME/.local", \
"/tmp" ]
"/tmp", \
"/data" ]
ENTRYPOINT [ "/usr/bin/google-chrome" ]
CMD [ "--user-data-dir=/data" ]
# "--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
```
Extra
=====
## Extra Notes
Good & stable vsync
```
chrome://flags/
Enable "Override software rendering list"
```
Note that /dev/shm should be mounted from host to the docker container.
Verify
Check
```
chrome://gpu/
```
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://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"
as there is no hardware decoding for them.
To do this, install h264ify extension from
```
https://chrome.google.com/webstore/detail/h264ify/aleakchihdccplidncghkekgioiakgal?hl=en-US
```
Check the codecs
```
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'
# Initialize
# docker run --rm -ti -v chrome_data:/data busybox /bin/sh -c "chown 1000:1000 /data"
volumes:
data: {}
services:
chrome:
build: ./
image: andrey01/chrome
read_only: true
networks:
- isolated
network_mode: bridge
devices:
- /dev/dri
# - /dev/video0
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:ro
- $XDG_RUNTIME_DIR/pulse:/run/user/1000/pulse
- /dev/shm:/dev/shm
- /tmp/.X11-unix:/tmp/.X11-unix
- /tmp/krb5cc_1000:/tmp/krb5cc_1000:ro
- data:/data
- $HOME/Downloads:/home/user/Downloads
- /var/run/cups:/var/run/cups:ro
- $HOME/.config/google-chrome/:/data
- $HOME/Downloads:/home/chrome/Downloads
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:ro
# - /tmp/krb5cc_1000:/tmp/krb5cc_1000:ro
environment:
DISPLAY: unix$DISPLAY
PULSE_SERVER: tcp:pulseaudio:4713
cap_add:
- SYS_ADMIN
networks:
isolated:
external:
name: isolated
- DISPLAY=unix$DISPLAY
- PULSE_SERVER=unix:$XDG_RUNTIME_DIR/pulse/native
# for some unknown reason the ownCloud's (v9.0.0) calendar (v1.0.0.0) does work correctly,
- TZ=Europe/Amsterdam
# unless the timezone is set
# security_opt:
# - apparmor:docker-ptrace
# - apparmor:unconfined
# cap_add:
# - SYS_ADMIN