Skip to main content

Open Source Deployment

The open-source version of Browserless lets you deploy headless browsers using Docker with full support for Puppeteer, Playwright, and REST APIs.

Key capabilities:

  • Out-of-the-box browser images for Chromium, Chrome, Firefox, WebKit, and Edge
  • Native support for Puppeteer and Playwright
  • Built-in REST APIs for screenshots, PDFs, scraping, and more
  • Debugging tools, session management, and health checks

Quick Start

  1. Run Browserless Container

    Running the docker image is similar to other docker run commands, and all options are passed in via environment variables. In the example below, we're starting the image with a maximum concurrency of 10 (further requests will be queued), and setting the token to 6R0W53R135510.

    # Run Chromium with configuration
    docker run \
    --rm \
    -p 3000:3000 \
    -e "CONCURRENT=10" \
    -e "TOKEN=6R0W53R135510" \
    ghcr.io/browserless/chromium

    # Or run all supported browsers
    docker run \
    --rm \
    -p 3000:3000 \
    -e "CONCURRENT=10" \
    -e "TOKEN=6R0W53R135510" \
    ghcr.io/browserless/multi
    warning

    Browserless is designed to always require a token. This means that, if you don't pass a TOKEN env variable, a randomly generated token will be set.

  2. Connect Your Application

    Here are complete examples of integrating Browserless into your application:

    const express = require("express");
    const puppeteer = require("puppeteer-core");

    const app = express();

    app.get("/image", async (req, res) => {
    let browser;
    try {
    // This was puppeteer.launch()
    browser = await puppeteer.connect({
    browserWSEndpoint: "ws://localhost:3000?token=6R0W53R135510",
    });
    const page = await browser.newPage();

    await page.goto("http://www.example.com/");
    const data = await page.screenshot();

    return res.end(data, "binary");
    } catch (error) {
    console.error("Error capturing screenshot:", error);
    return res.status(500).send("Error capturing screenshot");
    } finally {
    if (browser) {
    await browser.close();
    }
    }
    });

    app.listen(8080);
  3. Verify Setup

    Test your deployment with a simple REST API call:

    curl "http://localhost:3000/content?token=6R0W53R135510&url=https://example.com"

    This should return the HTML content of the example.com page, confirming your Browserless instance is working correctly.

Once running, visit http://localhost:3000/docs for API documentation.