https://github.com/docker-sstc/mono/tree/master/packages/headful-chromium
3.8K
To use the globally installed Playwright inside your project, link it using:
docker run --rm \
-v $(pwd):/app \
-w /app \
sstc/headful-chromium \
npm link playwright
You can run everything in a single container, or split responsibilities
This will start a browser and immediately run your automation script in the same container:
docker run --rm \
--init \
--ipc=host \
--privileged \
-v $(pwd):/app \
-w /app \
sstc/headful-chromium \
./example-entrypoint.sh node example-standalone.mjs
Step 1: Start the browser server in a dedicated container:
docker run --rm \
--init \
--ipc=host \
--name server \
-p 3000:3000 \
-v $(pwd):/app \
-w /app \
sstc/headful-chromium \
./example-entrypoint.sh node example-server.mjs
# If the client is running on a different host than the server, you may need to forward the debugging port using:
# socat TCP-LISTEN:9222,fork,reuseaddr TCP:127.0.0.1:9222
Step 2: In another terminal/process/container, connect to the running browser server and execute your automation:
docker run --rm \
--net host \
-v $(pwd):/app \
-w /app \
sstc/headful-chromium \
node example-client.mjs
Debian versions: https://www.debian.org/releases/
Ubuntu versions: https://ubuntu.com/about/release-cycle
Playwright versions: https://github.com/microsoft/playwright/releases
Playwright docker build files: https://github.com/microsoft/playwright/tree/main/utils/docker
Playwright docker image tags: https://mcr.microsoft.com/en-us/artifact/mar/playwright/tags
Playwright connect to remote: https://playwright.dev/docs/docker#remote-connection
headful commands: https://github.com/MauFournier/puppeteer-headful-with-commands
Dbus: https://github.com/microsoft/WSL/issues/7915#issuecomment-1163333151
apt update
apt install -y notification-daemon
apt install -y upower
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket
export RUNLEVEL=1
dbus-daemon --session --address=$DBUS_SESSION_BUS_ADDRESS --nofork --nopidfile --syslog-only &
# service dbus start
cat << EOF >> /usr/share/dbus-1/services/org.freedesktop.Notifications.service
[D-BUS Service]
Name=org.freedesktop.Notifications
Exec=/usr/lib/notification-daemon/notification-daemon
EOF
cat << EOF >> /usr/sbin/policy-rc.d
#!/bin/sh
exit 0
EOF
Local test:
docker build -f debian-12/Dockerfile -t test --build-arg PLAYWRIGHT_VERSION=1.53.1 --progress=plain --no-cache .
docker run -it --ipc=host -v $(pwd):/app -w /app test /bin/bash
docker run -v $(pwd):/app -w /app test ./example-entrypoint.sh node example-standalone.mjs
node --version
npm --version
chromium --version
Content type
Image
Digest
sha256:0bfd5b1b0…
Size
919.9 MB
Last updated
about 1 month ago
docker pull sstc/headful-chromium