playwright firefox and webkit fail in docker: missing dependencies
Fixes Playwright Firefox and WebKit launch failures in Docker caused by missing OS-level browser dependencies, via install --with-deps or the official Playwright image. Use it when Chromium works in the container but Firefox or WebKit crash on launch. Not for browser download failures, proxy issues, or headed-mode display problems.
TL;DR
Install the OS-level browser dependencies inside the image with npx playwright install --with-deps (it needs apt access at build time). The quickest reliable fix is basing your image on the official Playwright Docker image, which ships every dependency for Chromium, Firefox, and WebKit. Missing system libraries are the cause whenever Chromium works but Firefox and WebKit crash on launch.
Error
browserType.launch: Host system is missing dependencies to run browsers.
Please install them with the following command:
sudo npx playwright install-deps firefoxSteps
- In your Dockerfile, run the install as root before dropping privileges:
RUN npx playwright install --with-deps. Expected: the build log shows apt installing the browser dependency packages. - Or switch the base image to the official one, for example
FROM mcr.microsoft.com/playwright:v1.49.1-jammy. Expected: the image build succeeds with all browser deps present. - Re-run the failing Firefox and WebKit tests in the rebuilt image. Expected: both browsers launch and the tests execute.
When to use
- Firefox or WebKit fail at launch inside Docker while Chromium works.
- The error mentions missing dependencies or missing shared libraries.
- You are on a slim base image like
node:slim.
When not to use
- The browser binaries themselves failed to download (run
npx playwright installfirst). - The container cannot reach the network through a proxy.
- You need headed mode with a display (that needs xvfb, a different setup).
Tool compatibility
- Playwright 1.40 through 1.5x; match the Docker image tag to your Playwright version.
- Debian-based images (
-jammy);--with-depsuses apt, so it does not apply to Alpine.
Variant phrasings
playwright firefox failed to launch in docker container
Same missing-libraries root cause; install the deps or use the official image.
webkit launch failed missing shared libraries docker
The missing .so errors are the same dependency gap.
Why it happens
Playwright downloads browser binaries with install, but Firefox and WebKit need many more system shared libraries than Chromium does. Slim base images lack them, so the browser process dies at launch while Chromium (with fewer deps) survives.
Edge cases
- Corporate proxy blocks apt: pre-bake the deps into a base image once instead of installing per build.
--with-depsneeds root: run it in a root build stage, then copy to the runtime user.- Still fails after deps: check shared memory (
--shm-size=1gbor mount /dev/shm); low shm usually crashes Chromium first, but it can bite the others too.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_d2MyP6Pz9IZfKOcOj1jp3w
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.