Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Environment:Getgauge Taiko Docker Container

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Containerization
Last Updated 2026-02-12 03:00 GMT

Overview

Docker container environment for running Taiko browser automation tests using the `getgauge/taiko` base image with required Chrome flags and shared memory configuration.

Description

Running Taiko inside Docker containers requires specific Chrome launch flags to work within the restricted container environment. The default `/dev/shm` size in Docker (64MB) is insufficient for Chrome, causing crashes on large pages. The official `getgauge/taiko` Docker image bundles all necessary system libraries and Chromium. For custom images, system libraries from the Environment:Getgauge_Taiko_Linux_System_Libraries environment must be installed.

Usage

Use this environment for CI/CD pipelines, containerized test execution, and isolated test environments. It is the recommended approach for running Taiko tests in production CI systems where reproducibility and isolation are critical. Also required when running Taiko tests in Kubernetes pods or Docker Compose stacks.

System Requirements

Category Requirement Notes
Container Runtime Docker 18+ Or compatible runtime (Podman, containerd)
Base Image `getgauge/taiko` Includes Node.js, Chromium, and system libraries
Memory `--shm-size=1gb` (recommended) Default 64MB /dev/shm is insufficient for Chrome
Disk ~500MB for image Base image with all dependencies

Dependencies

Required Chrome Flags

  • `--no-sandbox` (Required in most Docker environments)
  • `--disable-dev-shm-usage` (Alternative to increasing /dev/shm size)

Recommended Chrome Flags for Parallel Execution

  • `--disable-gpu` (No GPU in containers)
  • `--disable-setuid-sandbox` (Sandbox not available)
  • `--no-first-run` (Skip first-run dialogs)
  • `--no-zygote` (Disable zygote process)

Optional Flags

  • `--start-maximized` or `--window-size=W,H` (Viewport control for responsive testing)

Credentials

No container-specific credentials required. Pass any Taiko environment variables via Docker `-e` flag:

  • `TAIKO_BROWSER_ARGS`: Pass Chrome flags (e.g., `--no-sandbox,--disable-dev-shm-usage`)

Quick Install

# Using official Taiko Docker image
docker run -it --rm --shm-size=1gb getgauge/taiko

# With environment variables
docker run -it --rm \
  --shm-size=1gb \
  -e TAIKO_BROWSER_ARGS="--no-sandbox,--disable-dev-shm-usage" \
  getgauge/taiko

# Custom Dockerfile
FROM getgauge/taiko
COPY . /app
WORKDIR /app
RUN npm install
CMD ["npm", "test"]

Code Evidence

Browser args environment variable handling from `lib/browser/launcher.js:21-26`:

const envArgs = process.env.TAIKO_BROWSER_ARGS
  ? process.env.TAIKO_BROWSER_ARGS.split(/\s*,?\s*--/)
      .filter((arg) => arg !== "")
      .map((arg) => `--${arg}`)
  : [];
return args.concat(additionalArgs, envArgs);

Docker documentation from `docs/taiko_in_docker.md:56-62`:

Chromium cannot be started in restricted environments like docker
without disabling sandbox.
Set TAIKO_BROWSER_ARGS with --no-sandbox

Shared memory advice from `docs/taiko_in_docker.md:76-83`:

By default Docker allocates 64MB to /dev/shm. Chrome requires
/dev/shm to be larger. Use --shm-size=1gb flag with docker run.
Alternative: use --disable-dev-shm-usage with Chrome 65+.

Common Errors

Error Message Cause Solution
`Failed to move to new namespace` Sandbox not available in container Add `--no-sandbox` to TAIKO_BROWSER_ARGS
`session deleted because of page crash` /dev/shm too small (64MB default) Run Docker with `--shm-size=1gb` or use `--disable-dev-shm-usage`
`Error: ENOENT: no such file or directory` OS-specific node_modules mounted from host Delete node_modules before volume mounting; rebuild inside container
`Chrome failed to start` Missing system libraries in custom image Use `getgauge/taiko` base image or install libraries from Linux_System_Libraries environment

Compatibility Notes

  • Volume Mounting: Node_modules from the host OS may contain OS-specific binaries. Delete node_modules before mounting and reinstall inside the container.
  • Parallel Execution: For running multiple Taiko instances in parallel on cloud infrastructure, combine flags: `--disable-gpu --disable-dev-shm-usage --disable-setuid-sandbox --no-first-run --no-sandbox --no-zygote`.
  • Alpine-based Images: Not officially tested. The `getgauge/taiko` image is Debian-based.
  • Rootless Docker: May require additional configuration for Chrome sandbox compatibility.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment