mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00

This adds a new script to calculate docker image size with all parent layers. Note: take this metrics with a grain of salt, since in reality docker compresses and reuses layers. Some historic stats obtained with this script: - **`208MB`** (-33MB) chore(docker): skip "recommended" dependencies (#2917) (1cebf8757c35cebb91c27d16e6b0aa1fcae42fcb) - **`241MB`** (-29MB) chore(docker): trim some of the gstreamer dependencies (#2897) (bce4b1aea95790ebc1f592c44acdea1a1e709fac) - **`272MB`** (-1MB) devops: do cache busting for APT (#2656) (bb3441809541cc6609c5444063973c4ab922981b) - **`273MB`** (+49MB) fix(webkit): update Docker file to include gstreamer (#2636) (5c6c65915c47b8d2f71f5fa75821460183530414) - **`224MB`** (+0MB) chore: fix emojis for CR and FF in Dockerfile (#2522) (24316ad261ca081b6d77dd2f655a42b4836a622b) - **`224MB`** (-1MB) fix: Dockerfile for Firefox (#1937) (b516ac4fb233d30964930d830dea7832a9aae031) - **`225MB`** (+49MB) devops(docker): Install ffmpeg dependency, adding codecs necessary for video playback in Firefox (#1627) (222d01caaadad7419c4e54b4f36a6e9d41d8dc65) - **`176MB`** (+32MB) chore(docs): optionally install XVFB in docker(ec3ee660430336d47a309553981eb960e49c2ede) - **`144MB`** (+144MB) feat: add a playwright-ready docker image (#1161)(1781ae7006554eb77ed42bf90be70ef637fd1aae)
Running Playwright in Docker
Dockerfile.bionic is a playwright-ready image of playwright. This image includes all the dependencies needed to run browsers in a Docker container.
Usage
This image is published on Docker Hub.
Pull the image
$ docker pull mcr.microsoft.com/playwright:bionic
Run the image
$ docker container run -it --rm --ipc=host --security-opt seccomp=chrome.json mcr.microsoft.com/playwright:bionic /bin/bash
Note that:
- The seccomp profile is required to run Chrome without sandbox. Thanks to Jessie Frazelle.
- Using
--ipc=host
is also recommended when using Chrome (Docker docs). Chrome can run out of memory without this flag.
Using on CI
See our Continuous Integration guides for sample configs.
Development
Build the image
$ docker build -t mcr.microsoft.com/playwright:bionic -f Dockerfile.bionic .
Push
Playwright on Docker Hub is published via the Microsoft Container Registry.
$ docker push playwright.azurecr.io/public/playwright:bionic
Base images
playwright:bionic
is based on Ubuntu 18.04 LTS (Bionic Beaver).
Alpine
Browser builds for Firefox and WebKit are built for the glibc library. Alpine Linux and other distributions that are based on the musl standard library are not supported.