Following the changes with the Rate Limiting on Docker Hub. Tweet here for more information in
zenika/alpine-chrome
gcr.io/zenika-hub/alpine-chrome
eu.gcr.io/zenika-hub/alpine-chrome
asia.gcr.io/zenika-hub/alpine-chrome
us.gcr.io/zenika-hub/alpine-chrome
Dockerfile
linkslatest
, 89
(Dockerfile)with-node
, 89-with-node
, 89-with-node-14
(Dockerfile)with-puppeteer
, 89-with-puppeteer
(Dockerfile)with-playwright
, 89-with-playwright
(Dockerfile)with-selenoid
, 89-with-selenoid
(Dockerfile)with-chromedriver
, 89-with-chromedriver
(Dockerfile)86
, 85
, 84
, 83
, 81
, 80
, 77
, 76
, 73
, 72
, 71
, 68
, 64
86-with-node
, 85-with-node
, 84-with-node
, 83-with-node
, 81-with-node
, 80-with-node
, 77-with-node
, 76-with-node
86-with-puppeteer
, 85-with-puppeteer
,84-with-puppeteer
, 83-with-puppeteer
, 81-with-puppeteer
, 80-with-puppeteer
, 77-with-puppeteer
, 76-with-puppeteer
Chrome running in headless mode in a tiny Alpine image
In the world of webdev, the ability to run quickly end-to-end tests are important. Popular technologies like Puppeteer enable developers to make fun things like testing, automating forms, crawling, generating screenshots, capturing timeline... And there is a secret: some of these features are directly available on Chrome!
Launching the container using only docker container run -it zenika/alpine-chrome ...
will fail with some logs similar to #33.
Please use the 3 others ways to use Chrome Headless.
--no-sandbox
Launch the container using:
docker container run -it --rm zenika/alpine-chrome
and use the --no-sandbox
flag for all your commands.
Be careful to know the website you're calling.
Explanation for the no-sandbox
flag in a quick introduction here and for More in depth design document here
SYS_ADMIN
capabilityLaunch the container using:docker container run -it --rm --cap-add=SYS_ADMIN zenika/alpine-chrome
This allows to run Chrome with sandboxing but needs unnecessary privileges from a Docker point of view.
seccomp
Thanks to ever-awesome Jessie Frazelle seccomp profile for Chrome. This is The most secure way to run this Headless Chrome docker image.
Also available here wget https://raw.githubusercontent.com/jfrazelle/dotfiles/master/etc/docker/seccomp/chrome.json
Launch the container using:docker container run -it --rm --security-opt seccomp=$(pwd)/chrome.json zenika/alpine-chrome
The default entrypoint does the following command: chromium-browser --headless --disable-gpu --disable-software-rasterizer --disable-dev-shm-usage
You can get full control by overriding the entrypoint using: docker container run -it --rm --entrypoint "" zenika/alpine-chrome chromium-browser ...
Command (with no-sandbox): docker container run -d -p 9222:9222 zenika/alpine-chrome --no-sandbox --remote-debugging-address=0.0.0.0 --remote-debugging-port=9222 https://www.chromestatus.com/
Open your browser to: http://localhost:9222
and then click on the tab you want to inspect. Replace the beginninghttps://chrome-devtools-frontend.appspot.com/serve_file/@.../inspector.html?ws=localhost:9222/[END]
bychrome-devtools://devtools/bundled/inspector.html?ws=localhost:9222/[END]
Command (with no-sandbox): docker container run -it --rm zenika/alpine-chrome --no-sandbox --dump-dom https://www.chromestatus.com/
Command (with no-sandbox): docker container run -it --rm -v $(pwd):/usr/src/app zenika/alpine-chrome --no-sandbox --print-to-pdf --hide-scrollbars https://www.chromestatus.com/
Command (with no-sandbox): docker container run -it --rm -v $(pwd):/usr/src/app zenika/alpine-chrome --no-sandbox --screenshot --hide-scrollbars https://www.chromestatus.com/
Command (with no-sandbox): docker container run -it --rm -v $(pwd):/usr/src/app zenika/alpine-chrome --no-sandbox --screenshot --hide-scrollbars --window-size=1280,1696 https://www.chromestatus.com/
Command (with no-sandbox): docker container run -it --rm -v $(pwd):/usr/src/app zenika/alpine-chrome --no-sandbox --screenshot --hide-scrollbars --window-size=412,732 https://www.chromestatus.com/
Command (with no-sandbox): docker container run -u `id -u $USER` -it --rm -v $(pwd):/usr/src/app zenika/alpine-chrome --no-sandbox --screenshot --hide-scrollbars --window-size=412,732 https://www.chromestatus.com/
Go the deno src
folder. Build your image using this command:
docker image build -t zenika/alpine-chrome:with-deno-sample .
Then launch the container:
docker container run -it --rm zenika/alpine-chrome:with-deno-sample
Download https://deno.land/std/examples/welcome.ts
Warning Implicitly using master branch https://deno.land/std/examples/welcome.ts
Compile https://deno.land/std/examples/welcome.ts
Welcome to Deno ��
With your own file, use this command:
docker container run -it --rm -v $(pwd):/usr/src/app zenika/alpine-chrome:with-deno-sample run helloworld.ts
Compile file:///usr/src/app/helloworld.ts
Download https://deno.land/std/fmt/colors.ts
Warning Implicitly using master branch https://deno.land/std/fmt/colors.ts
Hello world!
With tool like "Puppeteer", we can add a lot things with our Chrome Headless.
With some code in NodeJS, we can improve and make some tests.
See the "with-puppeteer" folder for more details. We have to follow the mapping of Chromium => Puppeteer described here.
If you have a NodeJS/Puppeteer script in your src
folder named pdf.js
, you can launch it using the following command:
docker container run -it --rm -v $(pwd)/src:/usr/src/app/src --cap-add=SYS_ADMIN zenika/alpine-chrome:with-puppeteer node src/pdf.js
With the "wqy-zenhei" library, you could also manipulate asian pages like in "screenshot-asia.js"
docker container run -it --rm -v $(pwd)/src:/usr/src/app/src --cap-add=SYS_ADMIN zenika/alpine-chrome:with-puppeteer node src/screenshot-asia.js
These websites are tested with the following supported languages:
https://m.baidu.com
)https://www.yahoo.co.jp/
)https://www.naver.com/
)Like "Puppeteer", we can do a lot things using "Playwright" with our Chrome Headless.
Go to the with-playwright
folder and launch the following command:
docker container run -it --rm -v $(pwd)/src:/usr/src/app/src --cap-add=SYS_ADMIN zenika/alpine-chrome:with-playwright node src/useragent.js
A example-chromium.png
file will be created in your with-playwright/src
folder.
By default, this image works with WebGL.
If you want to disable it, make sure to add --disable-gpu
when launching Chromium.
The with-webgl
tag still exists but is deprecated. It will be removed before end of August 2020.
docker container run -it --rm --cap-add=SYS_ADMIN -v $(pwd):/usr/src/app zenika/alpine-chrome --screenshot --hide-scrollbars https://webglfundamentals.org/webgl/webgl-fundamentals.html
docker container run -it --rm --cap-add=SYS_ADMIN -v $(pwd):/usr/src/app zenika/alpine-chrome --screenshot --hide-scrollbars https://browserleaks.com/webgl
Links:
ChromeDriver is a separate executable that Selenium WebDriver uses to control Chrome.You can use this image as a base for your Docker based selenium tests. See Guide for running Selenium tests using Chromedriver.
Selenoid is a powerful implementation of Selenium hub using Docker containers to launch browsers.Even if it used to run browsers in docker containers, it can be quite useful as lightweight Selenium replacement.with-selenoid
image is a self sufficient selenium server, chrome and chromedriver installed.
You can run it with following command:
docker container run -it --rm --cap-add=SYS_ADMIN -p 4444:4444 zenika/alpine-chrome:with-selenoid -capture-driver-logs
And run your tests against http://localhost:4444/wd/hub
One of the use-cases might be running automation tests in the environment with restricted Docker environmentlike on some CI systems like GitLab CI, etc. In such case you may not have permissions for --cap-add=SYS_ADMIN
and you will need to pass the --no-sandbox
to chromedriver
.
See more selenoid docs
We can run the container as root with this command:
docker container run --rm -it --entrypoint "" --user root zenika/alpine-chrome sh
Some examples are available on the examples
directory:
Headless Chrome website: https://developers.google.com/web/updates/2017/04/headless-chrome
List of all options of the "Chromium" command line: https://peter.sh/experiments/chromium-command-line-switches/
Where to file issues: https://github.com/Zenika/alpine-chrome/issues
Maintained by: https://www.zenika.com
docker container run -it --rm --entrypoint "" zenika/alpine-chrome cat /etc/alpine-release
3.13.2
docker container run -it --rm --entrypoint "" zenika/alpine-chrome chromium-browser --version
Chromium 89.0.4389.72
docker image inspect zenika/alpine-chrome --format='{{.Size}}'
412889529
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
原来一直是用wkhtmltopdf来将网页打印成PDF文件,它是基于QtWebKit内核的。但最近有个很奇怪 的字体问题困扰着我。所以找找其它能在Linux下实现相同功能的方法。然后发现Chrome Headless模式可 以实现我想要的,而且用Chrome来实现,可以排除掉很多Bug怀疑。 Chrome Headless模式相当于一个没有界面的浏览器,能实现很多功能,能实现pdf打印,截图等,扩
一、问题 Step 1/6 : FROM frolvlad/alpine-oraclejdk8:slim ERROR: Service 'config-server' failed to build: pull access denied for frolvlad/alpine-oraclejdk8, repository does not exist or may require 'docke
无论是测试还是爬虫的一些工作,有时候都会用到selenium去对chrome执行自动化操作,这里介绍一下如何使用docker快捷方便的部署相关应用。 1. selenium+chrome镜像 通过docker search selenium我们发现,有一个docker镜像叫做selenium/standalone-chrome。 看名字应该是包含了selenium和chrome,按照之前的方式我们
1.镜像加速, 将原装的alpine库替换成国内的ustc库 sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories 2. apk库更新 apk update 3.apk安装组件,比如常用的:ping、wget、curl等 wget与curl正常安装,安装好后即可使用 apk add wget ap
Karma和Jasmine结合使用,为前端提供了单体测试框架,Karma用于执行测试用例,一般情况下它会启动浏览器然后执行测试用例,这篇文章介绍一下如何在Alpine容器中使用Karma和Jasmine执行前端测试用例与常见问题。 Alpine容器版本 ~ # cat /etc/alpine-release 3.9.4 ~ # 常见问题1: 找不到Chrome浏览器 现象 使用ng test
1.修改apt-get源地址为阿里云镜像 echo "" > /etc/apt/sources.list echo "deb http://mirrors.aliyun.com/debian buster main" >> /etc/apt/sources.list echo "deb http://mirrors.aliyun.com/debian-security buster/updates
Alpine 简介 图 1.21.2.1 - Apline Linux 操作系统 Alpine 操作系统是一个面向安全的轻型 Linux 发行版。它不同于通常 Linux 发行版,Alpine 采用了 musl libc 和 busybox 以减小系统的体积和运行时资源消耗,但功能上比 busybox 又完善的多,因此得到开源社区越来越多的青睐。在保持瘦身的同时,Alpine 还提供了自己的包管理
vi /etc/apk/repositories # 添加官方 Testing 源 # http://nl.alpinelinux.org/alpine/edge/testing 使用 APK 安装 apk add php7-pecl-xlswriter
alpine-xmrig XMRig miner in an Alpine Linux Docker image. The goal of this project is to quickly enable you to mine Monero without the hassle of knowing how to install or secure your mining software.
docker-alpine 是一个极小的 Alpine Linux Docker 镜像,大小只有 5 MB。 REPOSITORY TAG IMAGE ID VIRTUAL SIZEgliderlabs/alpine latest 157314031a17 5.03 MBdebian la
Tailwind/Alpine Chrome Extension Boilerplate This is a starting place for building a Web Extension with Tailwindcss & Alpinejs Basic Popup with Tailwind Alpine @click Works! Basic Options Installation