Run Playwright tests in Docker with the official image
Answer first
Run Playwright tests in Docker from the official image tagged with your exact Playwright version, such as mcr.microsoft.com/playwright:v1.65.1-noble, with --init and --ipc=host, then npm ci and npx playwright test inside it. The image has the browsers but not your Playwright package.
- Published
- Updated
- min
- 6
The official Playwright Docker image is a ready-made Linux environment with Node.js, the Playwright browsers and every system library they need. It is the quickest way to make browser tests run the same on a laptop and on any machine with Docker. Playwright describes it as "intended to be used for testing and development purposes only" (Playwright Docker, read 2026-11-26).
What is in the official Playwright image?
The image holds Node.js, the browsers and the browsers' system dependencies, and not your Playwright package. Playwright: "The Playwright package/dependency is not included in the image and should be installed separately" (Playwright Docker, read 2026-11-26). The 1.65.1 image's build file shows the details: it installs Node.js 26 and git on Ubuntu, creates a pwuser account and sets PLAYWRIGHT_BROWSERS_PATH=/ms-playwright, where the browser builds live (Playwright Dockerfile.noble at v1.65.1, read 2026-11-26).
Table: Official Playwright image tags for release 1.65.1
| Tag | Base | Notes |
|---|---|---|
v1.65.1-noble | Ubuntu 24.04 LTS (Noble Numbat) | Node.js image |
v1.65.1-jammy | Ubuntu 22.04 LTS (Jammy Jellyfish) | Node.js image |
v1.65.1-resolute | Newer Ubuntu base | Listed in the registry, not on the docs page |
playwright/python:v1.65.2-noble | Ubuntu 24.04 | The Python image, with Python's own version number |
The tags come from the image registry's tag list for playwright and playwright/python (image registry tag list, read 2026-11-26). Each tag also has -amd64 and -arm64 variants. The docs page still shows v1.64.1; the 1.65 images were already published when we checked.
Where can the image run?
The image can run anywhere Docker images run. Three common places, each with the same image:
- On Promigence, as a verified snapshot. Promigence's quickstart builds a snapshot from a container image you name, with setup steps and a verify command, and "If verify does not exit zero, nothing is stored" (Promigence quickstart, read 2026-11-26). Its CLI reference adds that a tag given to
--image"is pinned to its digest for you", and that the same command builds from "an image, a Dockerfile, a devcontainer.json, a git repository or a local directory" (Promigence CLI reference, read 2026-11-26). For an image in a private registry, its errors page says to name a stored secret that holds the registry's user and password (Promigence errors page, read 2026-11-26). With the Playwright image as the base and your test command as the verify step, a stored snapshot is one in which the browsers have already started and passed your suite:
COMMIT=$(git rev-parse HEAD)
promigence snapshot create \
--image mcr.microsoft.com/playwright:v1.65.1-noble \
--setup "git clone https://github.com/your-org/your-app /work/repo && git -C /work/repo checkout $COMMIT" \
--setup "cd /work/repo && npm ci" \
--verify "cd /work/repo && npx playwright test" \
--tier small --alias e2e --wait --wait-timeout 10m
Pin the commit, as here: the quickstart notes that "a snapshot built from a moving ref is not reproducible".
- On your own machine or server, with
docker run. The steps below. - As the base of your own image. A
FROMline plus your project, also below.
Other hosted services start from a container image as well, each with its own rules for where the image may come from and how a build is checked (read 2026-11-26):
- AWS: Amazon Bedrock AgentCore Runtime runs a container image you build and push to Amazon ECR. On platform version V2 it snapshots the container when its health check first passes, and a health check that does not pass in time fails the deployment (AgentCore Runtime documentation).
- Daytona: a snapshot can come from "any publicly accessible image or container registry" and needs a tag or digest, so a pinned tag such as
v1.65.1-noblemeets its rule;latest,ltsandstableare refused (Daytona snapshots documentation). - E2B: a template's
fromImage()accepts "any Docker image from Docker Hub or other registries" on a Debian, Ubuntu, Fedora, RHEL-family, Arch or Alpine base, and an unsupported image fails the build with an error that names the reason (E2B base image documentation). - Google Cloud: Cloud Run deploys images straight from Artifact Registry, Docker Hub or GitHub Container Registry; an image on another registry, such as the Playwright one, goes through an Artifact Registry remote repository (Cloud Run deploying documentation).
- Modal:
modal.Image.from_registry()builds a Sandbox's image from an external registry image with a fixed tag (Modal Sandboxes guide).
How do I run my tests in the image with docker run?
Mount your project, install its packages inside the container, and run the tests.
- Check your Playwright version, and pick the tag that matches it:
npx playwright --version
- Run the container with the recommended flags. Playwright's command is
docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v1.64.1-noble /bin/bash(Playwright Docker, read 2026-11-26). For a one-shot test run with the 1.65.1 image:
docker run --rm --init --ipc=host \
-v "$PWD":/work -w /work \
mcr.microsoft.com/playwright:v1.65.1-noble \
/bin/bash -c "npm ci && npx playwright test"
- Read the results in
playwright-reportandtest-resultsin your project folder; the mount writes them back to the host.
Each flag has a documented reason:
--ipc=host: "Using--ipc=hostis recommended when using Chromium. Without it, Chromium can run out of memory and crash" (Playwright Docker, read 2026-11-26).--init: "recommended to avoid special treatment for processes with PID=1. This is a common reason for zombie processes."npm ciinside the container, never your host'snode_modules: packages with native parts are built for the host's system, and the container's is Linux.
Why must the image version match my Playwright version?
The image version must match because each Playwright release looks for its own browser builds. Playwright: "Each version of Playwright needs specific versions of browser binaries to operate" (Playwright browsers, read 2026-11-26). If the image is 1.65.1 and your lock file says 1.64.0, the tests look for browsers the image does not have. Update the tag in the same change that updates @playwright/test.
How do I build my own image on top of it?
Start FROM the matching tag, copy the lock file first so the install layer is cached, then copy the rest:
FROM mcr.microsoft.com/playwright:v1.65.1-noble
WORKDIR /work
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
CMD ["npx", "playwright", "test"]
Run it with the same flags: docker build -t my-e2e . then docker run --rm --init --ipc=host my-e2e. If you need a different Node.js or base image, Playwright lists what to install yourself: "you need to have Node.js, Playwright browsers and browser system dependencies installed", for example with RUN npx -y playwright@1.64.1 install --with-deps on a Node.js base (Playwright Docker, read 2026-11-26).
Should the tests run as root in the container?
Running as root is fine for testing your own app, and the image does so by default; use pwuser for anything untrusted. Playwright's Docker page explains that by default the browsers run as root, which disables the Chromium sandbox, and recommends a separate user with a custom system-call profile for crawling and scraping. For tests against your own application, root in a throwaway container is the documented default.
How do I keep the browsers in the container and run tests from outside?
Run Playwright's browser server in the container and connect to it from your machine. Playwright documents npx -y playwright@1.64.1 run-server --port 3000 --host 0.0.0.0 inside the image, then setting PW_TEST_CONNECT_WS_ENDPOINT to the server's ws:// address before npx playwright test (Playwright Docker, read 2026-11-26). The versions on both sides must match here too. This keeps your editor and test files on your machine while the browsers run in Linux.
What we read for this article
- Promigence quickstart, https://www.promigence.ai/docs/quickstart, read 2026-11-26
- Promigence CLI reference, https://www.promigence.ai/docs/cli, read 2026-11-26
- Promigence errors page, https://www.promigence.ai/docs/errors, read 2026-11-26
- Amazon Bedrock AgentCore Runtime documentation, read 2026-11-26
- Daytona snapshots documentation, read 2026-11-26
- E2B base image documentation, read 2026-11-26
- Cloud Run deploying documentation, read 2026-11-26
- Modal Sandboxes guide, read 2026-11-26
- Playwright Docker, read 2026-11-26
- Playwright Dockerfile.noble at v1.65.1, read 2026-11-26
- Playwright browsers, read 2026-11-26
- Playwright continuous integration, read 2026-11-26
- Image registry tag list for playwright, read 2026-11-26
Q&A
Which Playwright Docker image tag should I use?
The tag whose version matches the @playwright/test or playwright version in your lock file, on the Ubuntu base you want. For 1.65.1 that is v1.65.1-noble (Ubuntu 24.04) or v1.65.1-jammy (Ubuntu 22.04).
Why does Chromium crash in the Playwright Docker image?
Usually because the container's shared memory is too small. Playwright recommends --ipc=host for Chromium; without it, Chromium can run out of memory and crash.
Does the Playwright Docker image include Playwright?
No. The image includes Node.js, the browsers and their system dependencies, but the Playwright package must be installed from your project, for example with npm ci.
Is there a Playwright image for Python?
Yes. The Python image is published as mcr.microsoft.com/playwright/python with the same version tags, such as v1.65.2-noble.
Can I run headed tests in the Playwright image?
Yes. Playwright's CI guide says headed runs on Linux need Xvfb and that the Playwright Docker image includes it, so prefix the command with xvfb-run.