🎁 Surprise Discount: Enjoy 90% Off Your Subscription!

  • Pricing
  • Documentation
EN
Contact

© 2025 NST LABS TECH LTD. ALL RIGHTS RESERVED

Products

Anti-Detect Browser
Nstbrowser RPA
Cloudflare Bypass
Browserless
Web Unblocker

Solutions

Cloud Fingerprint Browser
Multi-Account Management
Web Scraping & Automation
Anti-Detection Bot

Resources

Pricing
Download
RPA Marketplace
Affiliate Program
Partners
Blog
Release Notes

Support

Contact

Documentation

Legal

Terms
Privacy Policy
Cookies Policy

ProductsSolutionsResourcesSupportLegal

ProductsSolutionsResources

SupportLegal

© 2025 NST LABS TECH LTD. ALL RIGHTS RESERVED

Back to Blog
docker
Browserless

Deploy Headlesschrome in Docker: Run in Browserless

How to deploy headlesschrome in Docker? This blog will inspire you with detailed steps to using Browserless in Docker container.
Sep 18, 2024Robin Brown

What is Browserless?

Browserless is a cloud-based browser solution designed for effective browser automation, web scraping, and testing.

It utilizes Nstbrowser’s fingerprint library to enable random fingerprint switching, ensuring smooth data collection and automation. Thanks to its robust cloud infrastructure, Browserless simplifies access to multiple browser instances, making it easier to manage automation tasks.

Do you have any wonderful ideas and doubts about web scraping and Browserless?
Let's see what other developers are sharing on Discord and Telegram!

How does Browserless work?

Browserless works by providing a headless browser as a service, which allows users to perform browser automation tasks without the need for a graphical interface.

It enables developers to run browser-based tasks, such as web scraping, automated testing, and rendering web pages, through APIs. By operating in a cloud environment, Browserless simplifies the process of automating browsers by eliminating the need for manual setup or maintaining browser infrastructure.

Browserless supports popular libraries like Puppeteer and Playwright, allowing users to interact with websites programmatically. Its Docker-based infrastructure allows for scalable and flexible deployment, making it efficient for both small-scale and enterprise-level applications. It can be integrated into workflows to automate repetitive tasks or gather data from websites that require a browser to access.

How to Deploy Headlesschrome in Docker?

Step 1: Get Your API Key

For a better experience, please create a new account on our official website.

Log in to the Nstbrowser client using the information you registered with. After successfully logging in, don't forget to generate your unique API key from the API menu!

API key

Step 2: Get the Nstbrowserless Image and Run

You need to get the API Key and replace the following {YOUR_API_KEY} part.

Bash Copy
docker run -it -e TOKEN={YOUR_API_KEY} -e SERVER_PORT=8848 -p 8848:8848 --name nstbrowserless nstbrowser/browserless:0.0.1-beta
replace with your API key

How to use Browserless in Docker Container?

You can connect to the headless browser through Puppeteer, Playwright, Chromedp or other CDP libraries to achieve the operation and screenshot functions of the headless browser.

Puppeteer

Puppeteer is a Node.js library that provides a high-level API to control the Chrome browser and supports operations through the DevTools protocol.

  1. Install Puppeteer
Bash Copy
npm install puppeteer
  1. Prepare the puppeteer.js file
JavaScript Copy
const puppeteer = require("puppeteer");

(async () => {
  const host = "127.0.0.1:8848"; // Replace with your Docker container IP
  const browserWSEndpoint = `ws://${host}/ws/connect`;
  
  try {
    const browser = await puppeteer.connect({
      browserWSEndpoint: browserWSEndpoint,
    });
    
    const page = await browser.newPage();
    await page.goto("https://google.com", { waitUntil: 'networkidle2' }); // Wait for the network to be idle
    await page.screenshot({ path: "screenshot.png", fullPage: true }); // Take a full-page screenshot

    console.log("Screenshot taken and saved as screenshot.png");
    
    await browser.close(); // Close the browser connection
  } catch (err) {
    console.error("Error occurred:", err);
  }
})();
  1. Run your scripts
Bash Copy
node puppeteer.js

After running, you can see that the headless browser is working as we wished:

headless browser working

Now, the project has finished, you can figure out the generated screenshot.png:

screenshot

Playwright CDP

Playwright is a framework for web testing and automation that allows testing the Chrome browser through a single API.

  1. Install the Playwright
Bash Copy
npm install playwright
  1. Prepare the playwright.js file
JavaScript Copy
import { chromium } from "playwright";

(async () => {
  const host = "127.0.0.1:8848"; // replace with your Docker container IP
  const browserWSEndpoint = `ws://${host}/ws/connect`;
  
  try {
    const browser = await chromium.connectOverCDP(browserWSEndpoint);
    const context = await browser.newContext();
    const page = await context.newPage();
    
    await page.goto("https://www.google.com/", { waitUntil: 'networkidle' }); // wait for the network to be idle
    await page.screenshot({ path: "screenshot.png" }); // take a full-page screenshot

    console.log("Screenshot taken and saved as screenshot.png");
    
    await browser.close(); // close the browser connection
  } catch (err) {
    console.error("Error occurred:", err);
  }
})();
  1. Run your scripts
Bash Copy
node playwright.js

Same as Puppeteer, after running, you can figure out the generated screenshot.png as well.

screenshot

The Bottom Lines

Browserless makes web scraping and automation easy. In this blog, you can see:

  • The effective way to deploy headlesschrome in Docker.
  • Detailed steps to use Browserless in Docker container.
    Running a browser inside a container provides a lot of flexibility and scalability. It is also much cheaper than traditional VM-based instances.

Nstbrowser gives you the optimal solution. Try Browserless for free now!

More
Running headless Chrome in the cloud for scalable web scraping
Headless BrowserWeb ScrapingBrowserless
How to Run Headless Chrome in the Cloud for Large-Scale Scraping
How to Run Headless Chrome in the Cloud for Large-Scale Scraping
Sep 02, 2025Robin Brown
Playwright vs. Puppeteer for Web Scraping
BrowserlessHeadless BrowserWeb Scraping
Playwright vs. Puppeteer for Web Scraping: Choosing Your Champion
Playwright vs. Puppeteer for Web Scraping: Choosing Your Champion
Sep 01, 2025Carlos Rivera
Puppeteer Stealth Plugin for Undetectable Web Scraping
BrowserlessHeadless BrowserWeb Scraping
Mastering Stealth: Leveraging Puppeteer Stealth Plugin for Undetectable Web Scraping
Mastering Stealth: Leveraging Puppeteer Stealth Plugin for Undetectable Web Scraping
Sep 01, 2025Robin Brown
The Best Headless Browser
Headless BrowserBrowserlessWeb Scraping
The Best Headless Browsers for Web Scraping: A Comprehensive Guide
The Best Headless Browsers for Web Scraping: A Comprehensive Guide
Sep 01, 2025Carlos Rivera
http-2-bypass
Browserless
What Is HTTP/2 Fingerprinting and How to Bypass It?
Learn how to bypass HTTP/2 fingerprinting in web scraping with six powerful methods, from using real browsers to cloud-based Browserless. Stay undetected against modern anti-bot defenses.
Jun 03, 2025Carlos Rivera
Load Browser Extensions in Nstbrowser Docker
Browserless
How to Load Browser Extensions in Nstbrowser Docker?
Learn 2 methods for uploading extensions in Nstbrowser and the steps to launch them in Docker.
Mar 19, 2025Carlos Rivera
Catalogue