From 36535a39117b3f820b540e6ef766710c702e2b38 Mon Sep 17 00:00:00 2001 From: Andrey Arapov Date: Sat, 7 May 2016 10:38:37 +0200 Subject: [PATCH] v2 --- Dockerfile | 46 ++++++++++++++++++++++------------------------ README.md | 22 +++++++++++++++------- asoundrc | 13 ------------- docker-compose.yml | 41 +++++++++++++++++++++++++---------------- 4 files changed, 62 insertions(+), 60 deletions(-) delete mode 100644 asoundrc diff --git a/Dockerfile b/Dockerfile index d973956..0cc73ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,42 +1,40 @@ # Run Chrome in a container -FROM debian:jessie +FROM ubuntu:xenial MAINTAINER Andrey Arapov # 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 - -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' - -# 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 + /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 + +# 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 + +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" ] diff --git a/README.md b/README.md index 900a28e..527b8a6 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/asoundrc b/asoundrc deleted file mode 100644 index 16bb602..0000000 --- a/asoundrc +++ /dev/null @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index 666e959..cee60e5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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