Skip to main content
Tutorial

A Scraping Stack in One Docker Compose File

Run a self-hosted scraping stack with docker compose: the fastCRW engine, its Chrome renderer, and an optional proxy profile, copy-paste and running in minutes.

fastcrw
By RecepNovember 22, 20268 min read

Tested against fastCRW's public Docker image, 2026-08-21.

A docker compose scraping stack, in one file

A self-hosted scraping stack needs three things: a server process that accepts scrape requests, a rendering path for JavaScript-heavy pages, and somewhere to route traffic when a site blocks your IP. The compose file below runs all three with fastCRW, an AGPL-3.0, single-binary scrape/crawl/map/search/extract engine. No Redis, no separate worker queue, no Playwright install step: the binary is ~8 MB and does its own rendering internally.

This is the deliberately boring version: one service, a health check, and a commented-out proxy profile you turn on only if you need it. If your workload is a handful of pages a day, you may not need Docker at all: see the "when to skip this" section at the end.

The base compose file

Save this as docker-compose.yml. It runs the engine on port 3000 with a persistent config volume and a restart policy suited to a small VPS.

services:
  crw-api:
    image: ghcr.io/fastcrw/crw:latest
    container_name: crw-api
    restart: unless-stopped
    ports:
      - "3000:3000"
    environment:
      CRW_SERVER__HOST: "0.0.0.0"
      CRW_SERVER__PORT: "3000"
      # Set a key to require Authorization: Bearer <key> on every request.
      # Omit it to run unauthenticated on a private network only.
      CRW_SERVER__API_KEY: "${CRW_API_KEY:-}"
    volumes:
      - crw-config:/root/.config/crw
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
      interval: 15s
      timeout: 5s
      retries: 5
    deploy:
      resources:
        limits:
          memory: 512M

volumes:
  crw-config:

Bring it up and confirm the health check passes:

docker compose up -d
docker compose ps
curl http://localhost:3000/api/health

The 512 MB memory cap is generous, not required. fastCRW's idle footprint is around 6.6 MB RAM with a working set near 50 MB per active render; the cap exists to stop a runaway Chrome tab from taking down a small VPS, not because the engine itself is heavy.

Renderer: it's built in, not a second container

Firecrawl's self-host and Crawl4AI both need you to run a separate headless-browser service (or install Playwright's browser binaries into the same container) and wire it up as a second hop. fastCRW's renderer ladder is inside the one binary: HTTP-only fetch first, then a lightweight JS engine, then a full Chrome instance via CDP, escalating only when a page actually needs it. There's no chrome service in the compose file above because there's nothing to add: Chrome is bundled in the image and launched on demand.

Test the render path directly. This request forces JS rendering so you can see the escalation happen:

curl -X POST http://localhost:3000/v1/scrape \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $CRW_API_KEY" \
  -d '{
    "url": "https://example.com",
    "renderJs": "on",
    "formats": ["markdown"]
  }'

Leave renderJs unset and it defaults to auto: the engine tries the cheap path first and only pays for a full Chrome render when the page comes back thin. On fastCRW's own 1,000-URL benchmark run against Firecrawl's public dataset, this ladder produced 87.7% scrape success (877/1,000) with 0 thrown errors across 3,000 requests and a 63.74% truth-recall score (522 of 819 labeled URLs), ahead of Crawl4AI's 59.95% and Firecrawl's 56.04% on the same set (diagnose_3way.py, 2026-05-08). p50 latency was 1,914 ms.

Adding the proxy profile

Skip this section if you're scraping your own sites or low-traffic public pages: direct egress is the right default and adding a proxy without a reason just adds a cost and a failure mode. Add it when you're hitting sites that rate-limit or block your server's IP after a burst of requests.

Extend the compose file with a second profile-gated service. Compose profiles let you keep the base stack simple and opt in only when you need the extra hop:

services:
  crw-api:
    # ...same as above, plus:
    environment:
      CRW_SERVER__HOST: "0.0.0.0"
      CRW_SERVER__PORT: "3000"
      CRW_SERVER__API_KEY: "${CRW_API_KEY:-}"
      CRW_CHROME_PROXY_WS_URL: "ws://crw-chrome-proxy:9222"
    depends_on:
      crw-chrome-proxy:
        condition: service_started
        required: false

  crw-chrome-proxy:
    image: ghcr.io/fastcrw/crw:latest
    container_name: crw-chrome-proxy
    profiles: ["proxy"]
    restart: unless-stopped
    command: ["crw", "serve", "--proxy-mode"]
    environment:
      CRW_CRAWLER__PROXY: "${PROXY_URL}"

Bring the proxy leg up explicitly:

docker compose --profile proxy up -d

Without --profile proxy, compose never starts crw-chrome-proxy and the engine falls back to direct egress, the safer default for a fresh setup, since a misconfigured proxy URL that silently routes every request through a dead endpoint is a worse failure than no proxy at all. Point PROXY_URL at whatever upstream proxy pool you already pay for; fastCRW doesn't ship one.

Verifying the stack end to end

Three checks confirm the stack is actually working, not just that containers are running:

  1. Health: curl http://localhost:3000/api/health returns 200.
  2. Plain scrape: a request without renderJs against a static page returns markdown in well under a second.
  3. Rendered scrape: the same request with renderJs: "on" against a JS-heavy page (a React SPA works well) returns content that a plain HTTP fetch would have missed, confirming the Chrome path actually launched.

If step 3 times out, check docker compose logs crw-api for a Chrome launch failure before assuming the target site is blocking you, a missing shared-memory allocation is a far more common cause on constrained VPS instances than an actual block.

Crawling a whole site from the same stack

The same container serves crawl and map without any extra service. A crawl job is queued, returns a job ID, and is polled until done:

curl -X POST http://localhost:3000/v1/crawl \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $CRW_API_KEY" \
  -d '{"url": "https://example.com", "maxDepth": 2, "limit": 10}'

# → {"id": "crawl_abc123", "status": "scraping"}

curl http://localhost:3000/v1/crawl/crawl_abc123 \
  -H "Authorization: Bearer $CRW_API_KEY"

The CLI wraps the same endpoints if you'd rather script it without curl:

crw crawl https://example.com --max-depth 2 --limit 10
crw map https://example.com

When to skip Docker entirely

If you're running scrapes from a single machine you already control, a laptop, a CI runner, a dev VM: installing the binary directly is less overhead than a compose file: curl -fsSL https://fastcrw.com/install | sh or brew install crw, then crw scrape <url>. Docker earns its place when you need the process supervised, restarted on crash, resource-capped, or deployed the same way across multiple hosts: not for a one-off script.

And if you'd rather not run infrastructure at all, the same /v1/scrape, /v1/crawl, and /v1/search endpoints are available against https://api.fastcrw.com with 1,000 free credits and no card, which is the faster path if you're prototyping rather than standing up a production self-host. See pricing for the self-host-vs-cloud tradeoff in full.

Connecting it to an agent over MCP

If the point of the stack is feeding an LLM agent rather than a script, point an MCP client at the same container instead of hand-rolling curl calls:

npx crw-mcp@latest init --claude-code

set CRW_API_URL to your compose host (http://localhost:3000) and the agent gets crw_scrape, crw_crawl, crw_map, and crw_search as tools against your own self-hosted stack rather than the managed cloud. See MCP web scraping in Claude and Cursor for the full client setup.

Sources

FAQ

Frequently asked questions

Do I need a separate container for the headless browser?
No. fastCRW bundles its Chrome renderer inside the single crw binary and launches it on demand via CDP, escalating from a plain HTTP fetch only when a page needs JavaScript. Tools that require a standalone browser service (a second container, Playwright binaries) add a hop this stack doesn't need.
How much RAM should I allocate to the compose service?
fastCRW idles around 6.6 MB RAM with a working set near 50 MB per active render. A 512 MB limit in the compose file is a safety cap against a runaway render, not a requirement, the engine itself runs comfortably on a $5 VPS.
When should I enable the proxy profile?
Only when a target site is actively rate-limiting or blocking your server's IP after repeated requests. Direct egress is the correct default; adding a proxy profile without that failure mode present just adds cost and one more thing that can silently misroute traffic.
Can this compose stack handle crawling a whole site, not just single pages?
Yes, the same crw-api container serves /v1/crawl and /v1/map alongside /v1/scrape. A crawl request returns a job ID you poll for status, with no separate queue or worker service required.

Get Started

Try fastCRW free

Run a live request in the playground — no signup required. Or grab a free API key with 1000 free credits, no credit card.

Continue exploring

More tutorial posts

View category archive