EXAMPLE 07
  • browsers
  • testing

Browsers with their sandbox

Run Playwright, Puppeteer or Electron in a sandbox without turning the browser's own sandbox off.


The problem

Chromium’s sandbox needs user namespaces, which docker’s default seccomp profile blocks, so people add --no-sandbox everywhere. devsandbox makes the browser sandbox work where it can, checks each new container, and tells the tools which case they are in.

Let your agent set this up

Try it

No config needed. run and devsandbox inspect web print what the check found:

OUTPUT
browser sandbox: on

Playwright turns Chromium’s sandbox off by default, so launch it like this:

playwright
const browser = await chromium.launch({
  chromiumSandbox: !!process.env.DEVSANDBOX_BROWSER_SANDBOX,
  executablePath: process.env.DEVSANDBOX_CHROME,
});

How it works

  • Docker sandboxes get docker’s default seccomp profile plus user namespaces. Podman’s default already allows them.
  • Where the check passes, every exec gets DEVSANDBOX_BROWSER_SANDBOX=1. Where it fails, the tools’ own sandbox-off variables are set instead.
  • Where execs run as root, DEVSANDBOX_CHROME points at a wrapper that starts the browser as a non-root user.
  • userns = false keeps docker’s default profile, with the browser sandbox off.

Agent instructions

Paste it into Claude Code, Codex or any agent with a shell. It finds your repo and config itself and asks only what it can't tell. Agent skills (opens in a new tab)

Source: site/src/content/examples/browsers.mdxEdit this page on GitHub(opens in a new tab)

MENU /
View on GitHub