/chromium-headless-remote

🐳 Dockerized Chromium in headless remote debugging mode

Primary LanguageMakefileMIT LicenseMIT

⚠️ Deprecated in favor of https://github.com/nextools/images/tree/master/chromium


version hub size

Dockerized Chromium in headless remote debugging mode.

Usage

docker run -it --rm -p 9222:9222 deepsweet/chromium-headless-remote:80

Example using Puppeteer:

Ensure to match version of puppeteer-core to the version of Chromium you are using:

npm install puppeteer-core@chrome-80
import fetch from 'node-fetch'
import puppeteer from 'puppeteer-core'

const response = await fetch('http://localhost:9222/json/version')
const { webSocketDebuggerUrl } = await response.json()

const browser = await puppeteer.connect({ browserWSEndpoint: webSocketDebuggerUrl })
const page = await browser.newPage()

await page.goto('https://example.com')
await page.screenshot({ path: 'example.png' })
await browser.close()

Fonts

It's possible to mount a folder with custom fonts to be used later by Chromium: add -v $(pwd)/path/to/fonts:/home/chromium/.fonts to docker run arguments.

How to update to the newer Chromium version

Docker Hub's Auto Builder is used to create versioned builds. Build instructions are set to look at Git tag value and create a corresponding Dcoker image tag.

To update the version:

  1. run make list
  2. pick newer version and paste it (properly shortened) in Makefile and Dockerfile
  3. commit all changes
  4. run make push

Related