/firefox-headless-remote

🐳 Dockerized Firefox in headless Marionette mode

Primary LanguageJavaScriptMIT LicenseMIT

version build size

Dockerized Firefox in headless Marionette mode.

Usage

docker pull deepsweet/firefox-headless-remote:68
docker run -it --rm --shm-size 2g -p 2828:2828 deepsweet/firefox-headless-remote:68

Example using Foxr:

import foxr from 'foxr'

(async () => {
  try {
    const browser = await foxr.connect()
    const page = await browser.newPage()

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

Fonts

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

Related