Skip to main content

Docker Web Scraping on Liquid Web: Containerize Your Scrapers

· 4 min read
Yassine El Haddad
Software Developer & Automation Specialist

I build production AI agents, web scrapers, and automation pipelines. Most of what I publish here comes from the actual problems they run into: proxies that get banned, anti-bot stacks that fingerprint your client, RAG that drifts when the underlying data moves. Stack: Python, TypeScript, Go, FastAPI, LangChain, Crawlee, Playwright, deployed on AWS, GCP, and Cloudflare.

Running web scrapers in Docker on a Liquid Web VPS gives you reproducible builds, easier deploys, and isolation from the host. This guide covers VPS choice, Docker install, a Playwright-based Dockerfile, and a docker-compose stack for scraper + Redis + cron.

Prerequisites

  • Liquid Web VPS with Ubuntu 22.04 or 24.04 (or similar Linux)
  • SSH access and sudo
  • At least 4 GB RAM for Playwright (2 GB for simple HTTP scrapers)

See Liquid Web VPS scraping setup for provisioning.

Step 1: Choose the Right VPS Plan

PlanvCPURAMStoragePriceUse case
4 GB24 GB80 GB$8.50/mo*Single Playwright scraper
8 GB48 GB240 GB$22.50/mo*Multiple scrapers or Crawlee
16 GB616 GB440 GB$45/mo*High-concurrency, Firecrawl

*Promotional pricing; check Liquid Web for current offers.

Step 2: Install Docker

# Ubuntu/Debian
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update && sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

Add your user to the docker group:

sudo usermod -aG docker $USER
# Log out and back in, or: newgrp docker

Verify:

docker --version
docker compose version

Step 3: Scraper Dockerfile (Playwright + Node)

Example for a Node.js Playwright scraper:

# Use official Playwright image for Chromium
FROM mcr.microsoft.com/playwright:v1.40.0-jammy

WORKDIR /app

COPY package*.json ./
RUN npm ci --omit=dev

COPY . .

ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
CMD ["node", "scraper.js"]

Or Python + Playwright:

FROM mcr.microsoft.com/playwright/python:v1.40.0-jammy

WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN playwright install chromium

COPY . .
CMD ["python", "scraper.py"]

For simple HTTP scraping (no browser), a slim Node image is enough:

FROM node:20-slim
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
CMD ["node", "scraper.js"]

Step 4: Docker Compose Stack

docker-compose.yml for a scraper with optional Redis:

services:
scraper:
build: .
mem_limit: 2g
restart: "no"
environment:
- REDIS_URL=redis://redis:6379
depends_on:
- redis

redis:
image: redis:alpine
restart: unless-stopped

For scheduled runs, use cron:

# Run scraper every hour
0 * * * * cd /home/user/scraper && docker compose run --rm scraper

Step 5: Build and Run

docker compose build
docker compose run --rm scraper

Or run Redis detached:

docker compose up -d redis
docker compose run --rm scraper

Playwright in Docker: Common Pitfalls

  1. Sandbox — Chromium needs --no-sandbox in containers. Playwright images do this by default.
  2. Memory — Allocate at least 2 GB to the scraper service.
  3. Display — No X11 needed; Playwright uses headless mode.

Alternative: Cloud Scraping

If you prefer not to manage containers:

Apify Affiliate Banner 728x90Apify Affiliate Banner 728x90Apify Affiliate Banner 300x50Apify Affiliate Banner 300x50
Next step

Start with the 4 GB Liquid Web plan, install Docker, and run a single scraper container.

Frequently Asked Questions

Yes for production: reproducible builds, easier deploys, isolation. Overkill for one-off scripts.

Use mcr.microsoft.com/playwright as base. Copy code, install deps, run entrypoint. Allocate at least 2GB RAM.

Playwright: mcr.microsoft.com/playwright. Simple HTTP: node:20-slim or python:3.11-slim.

Common mistakes and fixes

Docker container runs out of memory

Allocate at least 2GB RAM to the container. Use mem_limit in docker-compose. Prefer Playwright's chromium over full Chrome.

Playwright browser fails to launch in container

Use the official mcr.microsoft.com/playwright image or install deps via playwright install-deps. Run with --no-sandbox.