c0b / chrome-in-docker Goto Github PK
View Code? Open in Web Editor NEWrun Google Chrome in container (as a perfect headless browser)
Home Page: https://hub.docker.com/r/c0b0/chrome-stable/
run Google Chrome in container (as a perfect headless browser)
Home Page: https://hub.docker.com/r/c0b0/chrome-stable/
on some Linux systems, sometimes see Chrome browser may crash one page or two, seems happening randomly, not exactly sure why some page works some not, but since I know Chrome on Linux using a lot of large page memory mapping, which is a tmpfs mounting on /dev/shm on some Linux variants, and it depends on which Linux, the docker run instance may use the default 64MB, that may not be enough in some cases, you may set a different --shm-size 1024MB
or just share /dev/shm from host by -v /dev/shm:/dev/shm
on docker run
lines
$ docker run --help | grep shm
--shm-size string Size of /dev/shm, default value is 64MB
$ df -Th /dev/shm
Filesystem Type Size Used Avail Use% Mounted on
tmpfs tmpfs 3.9G 231M 3.7G 6% /dev/shm
Hi,
I've followed the instructions, and I don't seem to be getting anything.
I've tried pulling it:
$ docker pull c0b0/chrome-stable
$ docker run -it --rm c0b0/chrome-stable /opt/google/chrome/google-chrome --version Google Chrome 52.0.2743.116
I've also tried downloading the code and building it locally on my system.
$ docker build -t chrome-stable:20181022 .
$ docker run -it --rm chrome-stable:20181022 /opt/google/chrome/google-chrome --version Google Chrome 52.0.2743.116
$ docker tag chrome-stable:20181022 chrome-stable:52.0.2743.116
When I try to run it, all I get is
Google Chrome 70.0.3538.67
Then the command prompt.
ray@sys-2016-07-xu:~/z32_MISC/chrome-in-docker-master$ docker run -it --rm chrome-stable:20181022 /opt/google/chrome/google-chrome --version Google Chrome 52.0.2743.116
Google Chrome 70.0.3538.67
ray@sys-2016-07-xu:~/z32_MISC/chrome-in-docker-master$
ray@sys-2016-07-xu:~/z32_MISC/chrome-in-docker-master$ docker tag chrome-stable:20181022 chrome-stable:52.0.2743.116
ray@sys-2016-07-xu:~/z32_MISC/chrome-in-docker-master$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
chrome-stable 20181022 d0694f796f61 About a minute ago 738.5 MB
chrome-stable 52.0.2743.116 d0694f796f61 About a minute ago 738.5 MB
hello-world latest 767f6a55187c 11 months ago 1.848 kB
ubuntu latest 523bc6715b0a 11 months ago 122.8 MB
nginx 1.13 90ccaf7acdc9 11 months ago 108.4 MB
alpine latest e878ead083f2 11 months ago 3.966 MB
nginx latest c84ebc83ca5b 12 months ago 108.4 MB
mobydock_mobydock latest 6dcd69a12a3b 13 months ago 589.5 MB
ruby 2.3-slim f8c20eadf71c 13 months ago 276.7 MB
busybox latest bfb79db4e2ab 13 months ago 1.129 MB
c0b0/chrome-stable latest cf015844d24b 2 years ago 659.7 MB
postgres 9.4.5 ff155793d84e 2 years ago 263.1 MB
redis 2.8.22 579cf374438d 3 years ago 109 MB
ray@sys-2016-07-xu:~/z32_MISC/chrome-in-docker-master$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
I read the comments within "Google-chrome crashes with newer version", and I removed benchmarking:
it could be due to --enable-benchmarking or --enable-net-benchmarking you may drop both
My supervisord.conf now looks like this:
[supervisord]
nodaemon=true
[program:xvfb]
command=Xvfb :10 -screen 0 1920x1480x24+32 -ac -r -cc 4 -accessx -xinerama +extension Composite -extension RANDR +extension GLX
[program:x11vnc]
command=x11vnc -rfbport 5900 -display :10 -rfbauth /tmp/.vnc/passwd -forever -shared
[program:fluxbox]
command=fluxbox -display :10
[program:xterm]
command=xterm -display :10
[program:chrome]
command=%(ENV_CHROME)s --no-first-run
--user-data-dir=./chrome-data
--force-device-scale-factor=2
--remote-debugging-port=19222
environment=DISPLAY=":10"
[program:socat]
command=/usr/bin/socat -v -d tcp-listen:9222,reuseaddr,fork tcp:localhost:19222
I'm a noob with Docker, so I'm wondering if perhaps I am doing something wrong.
I'm running this in Ubuntu in VirtualBox on a system running Windows 10.
Can you verify that this does, indeed, still work?
THANKS!
Trying your image:
$ docker run -it --rm --name chrome c0b0/chrome-stable
+ VNC_STORE_PWD_FILE=/tmp/.vnc/passwd
+ '[' '!' -e /tmp/.vnc/passwd -o -n '' ']'
+ mkdir -vp /tmp/.vnc
mkdir: created directory '/tmp/.vnc'
+ x11vnc -storepasswd hola /tmp/.vnc/passwd
stored passwd in file: /tmp/.vnc/passwd
+ export CHROME=/opt/google/chrome/google-chrome
+ CHROME=/opt/google/chrome/google-chrome
+ sudo chown -Rv 2000:100 /tmp/chrome-data
changed ownership of '/tmp/chrome-data' from root:root to 2000:100
+ exec supervisord
2017-01-26 04:40:59,254 INFO supervisord started with pid 1
2017-01-26 04:41:00,258 INFO spawned: 'x11vnc' with pid 13
2017-01-26 04:41:00,261 INFO spawned: 'fluxbox' with pid 14
2017-01-26 04:41:00,265 INFO spawned: 'chrome' with pid 15
2017-01-26 04:41:00,268 INFO spawned: 'xterm' with pid 16
2017-01-26 04:41:00,270 INFO spawned: 'xvfb' with pid 17
2017-01-26 04:41:00,271 INFO spawned: 'socat' with pid 19
2017-01-26 04:41:00,289 INFO exited: x11vnc (exit status 1; not expected)
2017-01-26 04:41:00,377 INFO exited: xterm (exit status 1; not expected)
2017-01-26 04:41:02,015 INFO spawned: 'x11vnc' with pid 39
2017-01-26 04:41:02,016 INFO success: fluxbox entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-01-26 04:41:02,016 INFO success: chrome entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-01-26 04:41:02,018 INFO spawned: 'xterm' with pid 40
2017-01-26 04:41:02,019 INFO success: xvfb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-01-26 04:41:02,019 INFO success: socat entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-01-26 04:41:03,078 INFO success: x11vnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-01-26 04:41:03,078 INFO success: xterm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
But there is no response:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
300fc8ce982e c0b0/chrome-stable "/entry.sh" 10 minutes ago Up 10 minutes chrome
$ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' chrome
172.17.0.2
$ curl 172.17.0.2:9222/json/version
Host: macOS Sierra 10.12.2
I am not 100% sure it is what subject states. But I have strong suspicion that with Ubuntu 16.04 and Google Chrome 60 or better entry point is unsuccessful with starting a browser. It crashes. There is plenty of similar reports across the internet and it seems that problems first started with version 56. I am not sure how to downgrade Google Chrome, thus cannot verify it, so please treat this issue as head up and nothing more
Hi, thanks for this repo.
I've been struggling to find an example of a unique use case that I have. I'd like to download and launch chrome during my build process. I don't really care about the image created, all I care about is launching chrome during the build process and performing some e2e tests with my project. As long as they are successful and a build is created for my project (i.e. an image has been successfully created) - that's all I need to know.
Given this use case and the dockerfile in this project, is it even possible to launch chrome during the build process itself? If so, how would I do that?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.