HUB
Sign inSign up

sbx/playwright:latest

Multi-platform
Manifest digest

sha256:60aa158506a31b6961c170f896569f4bad155c6d439a0af7cc633a60cde665cf

Last pushed

7 days by dhibot

Type

Sandbox Kit

Manifest digest

sha256:60aa158506a31b6961c170f896569f4bad155c6d439a0af7cc633a60cde665cf

yaml
schemaVersion: "3"
displayName: Playwright
author: Docker, Inc. https://docker.com
description: Playwright CLI and test runner with headless Chromium for sandbox agents
sourceUrl: https://github.com/docker-hardened-images/definitions
version: 1.65.1
licenses:
    - Apache-2.0
kind: mixin
provides:
    - [email protected]
requires:
    - deb/apt
    - deb/bash
    - deb/coreutils
    - deb/grep
capabilities:
    - type: com.docker.sandbox/network-policy@1
      config:
        install:
            allow:
                - deb.debian.org
                - dhi.io
                - download.docker.com
                - cli.github.com
        runtime:
            allow:
                - cdn.playwright.dev
                - playwright.download.prss.microsoft.com
                - storage.googleapis.com
    - type: com.docker.sandbox/lifecycle@1
      config:
        install:
            - command: |
                set -eu
                set -- chromium chromium-common chromium-headless-shell
                command -v node >/dev/null 2>&1 || set -- "$@" "nodejs-${{ kit.args.nodeVersion }}"
                if ! command -v npm >/dev/null 2>&1 || ! command -v npx >/dev/null 2>&1; then
                  set -- "$@" npm
                fi
                apt-get update
                apt-get install -y --no-install-recommends "$@"
                . /etc/profile.d/playwright-env.sh
                playwright install-deps chromium
                rm -rf /var/lib/apt/lists/*
              description: Install Chromium, native libraries and missing Node or npm
              env:
                - HTTP_PROXY
                - HTTPS_PROXY
              user: "0"
            - command: |
                set -eu
                file=/etc/sandbox-persistent.sh
                line='. /etc/profile.d/playwright-env.sh'
                grep -qFx "$line" "$file" 2>/dev/null || printf '\n%s\n' "$line" >> "$file"
              description: Expose Playwright modules and browsers in non-login Bash shells
              user: "0"
    - type: com.docker.sandbox/agent-context@1
      optional: true
      config:
        content: |
            ## Playwright

            Playwright and @playwright/test are installed globally. Run
            `playwright --version` to see the installed release. Use
            `npx playwright test` for suites or `require('playwright')` in a
            Node script. NODE_PATH includes the global module directory.
            A project with local node_modules uses its local packages.

            Chromium and its headless shell are installed through apt. Only
            Chromium is provisioned. The sandbox has no display server, so use
            headless mode for screenshots, PDFs, traces and videos. Headed mode,
            codegen and the UI runner need a display server you supply.

            PLAYWRIGHT_BROWSERS_PATH points to /opt/ms-playwright. Keep this
            setting. The directory is writable by the agent so a project with
            a different Playwright pin can run `npx playwright install chromium`
            to download its matching revision. Browser CDN hosts are allowed.
            Firefox and WebKit need extra native libraries as well as downloads.

            External sites under test need their own network-policy grants.
            Browser-download permissions do not grant access to those sites.
    - type: com.docker.sandbox/agent-context@2
      optional: true
      config:
        content: |
            ## Playwright

            Playwright and @playwright/test are installed globally. Run
            `playwright --version` to see the installed release. Use
            `npx playwright test` for suites or `require('playwright')` in a
            Node script. NODE_PATH includes the global module directory.
            A project with local node_modules uses its local packages.

            Chromium and its headless shell are installed through apt. Only
            Chromium is provisioned. The sandbox has no display server, so use
            headless mode for screenshots, PDFs, traces and videos. Headed mode,
            codegen and the UI runner need a display server you supply.

            PLAYWRIGHT_BROWSERS_PATH points to /opt/ms-playwright. Keep this
            setting. The directory is writable by the agent so a project with
            a different Playwright pin can run `npx playwright install chromium`
            to download its matching revision. Browser CDN hosts are allowed.
            Firefox and WebKit need extra native libraries as well as downloads.

            External sites under test need their own network-policy grants.
            Browser-download permissions do not grant access to those sites.
args:
    nodeVersion:
        default: "24"
        description: DHI Node.js major to install only when Node is absent
        enum:
            - "22"
            - "24"
            - "26"
    version:
        required: true
        description: Playwright release carried by the DHI package
        pattern: ^[0-9]+\.[0-9]+\.[0-9]+$
        buildArg: PLAYWRIGHT_VERSION