Screenshot API with Docker & Kubernetes 2026

Deploy SnapAPI-powered screenshot services in Docker containers and Kubernetes clusters. No Chromium in your image, no browser process management, just a clean HTTP service.

Start Free — 200 screenshots/month

Why Screenshot APIs Simplify Docker Deployments

Running Playwright or Puppeteer in Docker containers requires installing a full Chromium binary and its system library dependencies -- libgbm, libnss3, libatk-bridge, and a dozen other shared libraries -- adding hundreds of megabytes to the container image and significantly increasing the attack surface of the deployed container. Screenshot APIs eliminate this entirely. A Docker container calling SnapAPI contains only your application code and its language runtime dependencies, producing a lean, fast-building, minimal-surface container image. The Dockerfile for a Node.js screenshot service that calls SnapAPI is standard Node.js -- FROM node:20-alpine, COPY package.json, RUN npm ci, COPY src, CMD node src/index.js -- with no browser-specific installation steps, no --shm-size flags, no sandboxing configuration, and no browser process health management. The same container runs identically in development, CI, staging, and production without browser version drift or sandbox configuration differences between environments.

Dockerfile for a SnapAPI Screenshot Service

A production-ready Dockerfile for a Node.js screenshot service calling SnapAPI uses a multi-stage build to separate the dependency installation stage from the final production image, minimizing the final image size and excluding development dependencies from the deployed container.

# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production

# Production stage
FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY src ./src
EXPOSE 3000
CMD ["node", "src/index.js"]

# Health check
HEALTHCHECK --interval=30s --timeout=5s CMD wget -qO- http://localhost:3000/health || exit 1

The resulting image is under 200MB -- a fraction of the 800MB-plus required for a Playwright-in-Docker image -- and starts in under two seconds on standard container infrastructure. Build and push to your container registry with standard docker build and docker push commands, referencing the SNAPAPI_KEY environment variable injected at runtime rather than baked into the image.

Kubernetes Deployment for Screenshot Service

Kubernetes deployments for SnapAPI-powered screenshot services use standard Deployment and Service manifests without the special container security context settings that browser-in-container deployments require. Playwright and Puppeteer containers need privileged mode, increased shared memory, or a custom seccomp profile to run Chromium in a Kubernetes pod -- SnapAPI-based services require none of these, running as a standard unprivileged container with the default Kubernetes security context. Configure the Deployment with resource requests and limits appropriate for the application's actual CPU and memory usage -- typically 100-250m CPU and 128-256Mi memory for a Node.js HTTP service -- rather than the elevated resource allocations required for in-process Chromium instances.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: screenshot-service
spec:
  replicas: 2
  template:
    spec:
      containers:
      - name: screenshot-service
        image: your-registry/screenshot-service:latest
        env:
        - name: SNAPAPI_KEY
          valueFrom:
            secretKeyRef:
              name: snapapi-secret
              key: api-key
        resources:
          requests: { cpu: "100m", memory: "128Mi" }
          limits:   { cpu: "500m", memory: "256Mi" }
        livenessProbe:
          httpGet: { path: /health, port: 3000 }
        readinessProbe:
          httpGet: { path: /ready, port: 3000 }

Kubernetes HPA for Screenshot Service Scaling

Kubernetes HorizontalPodAutoscaler scales the screenshot service based on CPU or custom metrics published to Prometheus, automatically adding pods during high-volume screenshot processing periods and scaling down during idle intervals. Configure the HPA with a minimum of two replicas for high availability and a maximum that stays within your SnapAPI plan's rate limit when all replicas are making concurrent screenshot calls. Each replica runs the screenshot service with an application-level concurrency limiter -- p-limit in Node.js, a semaphore in Python, or a channel-based limiter in Go -- that restricts each pod to a fraction of the total plan rate limit, ensuring that the full replica set stays within the plan rate when the HPA scales to maximum replicas. Publish custom queue depth metrics from your screenshot job queue to Prometheus and configure the HPA to scale on queue depth rather than CPU, enabling scale-up to begin before CPU pressure develops from pending queue jobs, reducing latency for batch screenshot processing workloads.

Docker Compose for Local Screenshot Service Development

Local development of a SnapAPI-powered screenshot service uses Docker Compose to run the screenshot service alongside its dependencies -- Redis for caching, PostgreSQL for metadata storage -- in a reproducible environment that matches the production container configuration. Define a docker-compose.yml with the screenshot service container, a Redis container for caching screenshot results, and a PostgreSQL container for job metadata, linking the services through a Docker bridge network. The screenshot service container reads the SNAPAPI_KEY from a .env file loaded by Docker Compose, keeping the API key out of the compose file and the version control history. Mount the application source directory as a volume in the screenshot service container and use nodemon or Air for Go to enable hot reload during development, so code changes are reflected immediately without rebuilding the container image on every edit cycle.

Kubernetes Ingress and TLS for Screenshot Service

Production Kubernetes deployments of the screenshot service expose the service externally through an Ingress resource with TLS termination, routing HTTPS traffic from the load balancer to the screenshot service pods. Configure the Ingress with cert-manager and Let's Encrypt to automatically provision and renew TLS certificates for the screenshot service domain, eliminating manual certificate management. Apply nginx Ingress annotations for rate limiting at the Ingress layer -- limiting requests per IP per minute -- to complement the application-level rate limiting, providing defense-in-depth protection against clients that attempt to exhaust the SnapAPI plan limit through high-frequency requests. Configure the Ingress with proxy-body-size annotations appropriate for the expected screenshot PNG response sizes, ensuring that large full-page screenshots are not truncated by default proxy body size limits in the Ingress controller configuration.

Observability for Docker and Kubernetes Screenshot Services

Screenshot services deployed in Docker and Kubernetes implement observability through structured logging, Prometheus metrics, and distributed tracing to provide visibility into screenshot capture latency, error rates, cache hit rates, and SnapAPI call volume. Configure the Node.js, Go, or Python screenshot service to emit structured JSON logs with fields for the request ID, the target URL hash, the SnapAPI response status, the total capture duration, and whether the result was served from cache. Expose a /metrics endpoint in Prometheus exposition format that publishes counters for total screenshot requests, SnapAPI calls made, cache hits and misses, and errors by type, enabling Grafana dashboards that visualize screenshot service health and throughput over time. Configure Kubernetes Pod Disruption Budgets to maintain a minimum number of running replicas during node maintenance and rolling deployments, ensuring that the screenshot service remains available during Kubernetes cluster operations that temporarily reduce pod count.

CI/CD Pipeline for Screenshot Service Docker Images

The screenshot service Docker image builds in CI using GitHub Actions, GitLab CI, or CircleCI on every push to the main branch, running tests against the SnapAPI mock, building the multi-stage Docker image, scanning the image for vulnerabilities with Trivy or Grype, and pushing the tagged image to the container registry. Configure the CI pipeline to fail the build if the vulnerability scan finds high or critical severity CVEs in the base image or application dependencies, preventing vulnerable images from reaching the container registry. Use Docker BuildKit cache mounts in the Dockerfile to cache the npm install or go mod download step between CI runs, significantly reducing build times for frequent deployments. Configure Kubernetes to automatically deploy the new image tag using a GitOps tool like ArgoCD or Flux that monitors the container registry for new image tags and triggers a rolling deployment when a new image is pushed, maintaining a complete audit trail of every deployment in the GitOps repository.

Screenshot API Docker and Kubernetes Summary

The core advantage of the SnapAPI approach in Docker and Kubernetes environments is architectural simplicity: the screenshot service is a standard HTTP microservice with no special runtime requirements, no browser process management, and no elevated security contexts. Standard Dockerfile patterns, standard Kubernetes Deployment manifests, standard HPA configuration, and standard CI/CD pipelines all work without modification. Teams that have previously struggled with Playwright-in-Docker's shared memory requirements, Chromium binary size, and sandbox security context issues find that the SnapAPI-based architecture eliminates all of these concerns in a single architectural decision. Sign up at snapapi.pics to get your API key and the two hundred free monthly screenshots needed to run through the Docker and Kubernetes examples in this guide in your own environment before committing to a plan upgrade for production workloads.