playwright/utils/docker
Andrey Lushnikov 4ab4c0bda1
feat: detect docker version and Playwright version mismatch (#12806)
This patch prints a friendly instructions in case Docker image version
mismatches Playwright version and there are missing browser
dependencies.

With this patch, Playwright will yield the following error:

```
root@f0774d2b2097:~# node a.mjs
node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

browserType.launch:
╔════════════════════════════════════════════════════════════════════════════════════════════╗
║ Host system is missing dependencies to run browsers.                                       ║
║ This is most likely due to docker image version not matching Playwright version:           ║
║ - Playwright: 1.22.0                                                                       ║
║ -     Docker: 1.21.0                                                                       ║
║                                                                                            ║
║ Either:                                                                                    ║
║ - (recommended) use docker image "mcr.microsoft.com/playwright:v1.22.0-focal"              ║
║ - (alternative 1) run the following command inside docker to install missing dependencies: ║
║                                                                                            ║
║     npx playwright install-deps                                                            ║
║                                                                                            ║
║ - (alternative 2) use Aptitude inside docker:                                              ║
║                                                                                            ║
║     apt-get install libgbm1                                                                ║
║                                                                                            ║
║ <3 Playwright Team                                                                         ║
╚════════════════════════════════════════════════════════════════════════════════════════════╝
    at file:///root/a.mjs:3:10 {
  name: 'Error'
}```

Fixes #12796

Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2022-03-25 14:45:53 -07:00
..
build.sh devops: demand explicit arch when building docker (#10743) 2021-12-07 09:28:59 -08:00
Dockerfile.bionic feat: detect docker version and Playwright version mismatch (#12806) 2022-03-25 14:45:53 -07:00
Dockerfile.focal feat: detect docker version and Playwright version mismatch (#12806) 2022-03-25 14:45:53 -07:00
publish_docker.sh feat: detect docker version and Playwright version mismatch (#12806) 2022-03-25 14:45:53 -07:00
seccomp_profile.json doc: further align docs w/ playwright.dev (#4866) 2021-01-03 08:47:29 -08:00
start_agent.sh fix(docker): do not export DISPLAY for everybody without XVFB running (#9795) 2021-10-26 13:21:18 -07:00