question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Error: EBUSY: resource busy or locked when using volumes in docker-compose with playwright 1.19.0 and mcr.microsoft.com/playwright:v1.15.0-focal

See original GitHub issue

Context:

  • Playwright Version: 1.19.0
  • Operating System: Linux in Docker
  • Node.js version: v16.13.2
  • Browser: Chromium
  • Extra: using volumes in docker-compose
  • The issue was not there with versions:
    • 1.16.3 for playwright
    • mcr.microsoft.com/playwright:v1.10.0-focal

Code Snippet Dockerfile:

FROM mcr.microsoft.com/playwright:v1.15.0-focal

RUN mkdir /app
WORKDIR /app

ENV PATH /app/node_modules/.bin:$PATH

COPY package.json package-lock.json /app/
RUN npm install && npx playwright install

COPY . /app/

in docker-compose.yml:

version: '3'

services:
  app:
    build: .
    command: 'bash'
    tty: true
    volumes:
      - /tmp/e2e-output:/tmp/e2e-output

in playwright.config.ts:

import { PlaywrightTestConfig } from '@playwright/test'

const config: PlaywrightTestConfig = {
  testDir: 'e2e',
  workers: 3,
  outputDir: '/tmp/e2e-output',
  use: {
    headless: false,
    screenshot: 'only-on-failure',
  },
  reporter: [['json'], ['list']],
}

export default config

in package.json:

...
"scripts": {
    "boot": "playwright install",
    "test": "dotenv-flow -- playwright test",
    "browser": "dotenv-flow -- playwright test --headed",
    "format": "eslint --cache --cache-strategy content --fix ."
  },
...

Describe the bug After building the docker image and run with npm run test inside of docker container, got this error:

Error: EBUSY: resource busy or locked, rmdir '/app/test-results'

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mapx-e2e@0.1.0 test: `dotenv-flow -- playwright test "report"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mapx-e2e@0.1.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-02-15T05_02_32_297Z-debug.log

and inside of log, there is nothing useful

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
akselikapcommented, Feb 23, 2022

You can get around this issue pretty easily by defining outputDir in playwright.config to something like reports/test-results and then simply mounting the reports dir as a volume.

2reactions
aslushnikovcommented, Feb 23, 2022

Yep I can repro. Turns out before 1.19 the test-results folder never actually was removed, so old results were piling in.

As of 2b55adaafa, we consider failure to clean up test results folder a fatal error. Let me see what we can do here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

EBUSY: resource busy or locked in Docker when trying to do ...
The solution that worked for me was: Persist the node_modules volume and bind the entire directory; Clear the cache; Install through docker.
Read more >
playwright Changelog - pyup.io
... [BUG] Error: EBUSY: resource busy or locked when using volumes in docker-compose with playwright 1.19.0 and mcr.microsoft.com/playwright:v1.15.0-focal
Read more >
playwright 1.19.2 on Node.js NPM - NewReleases.io
... [BUG] Error: EBUSY: resource busy or locked when using volumes in docker-compose with playwright 1.19.0 and mcr.microsoft.com/playwright:v1.15.0-focal ...
Read more >
Error: Ebusy: Resource Busy Or Locked Rmdir 'Path' - ADocLib
Error : EBUSY: resource busy or locked when using volumes in dockercompose with playwright 1.19.0 and mcr.microsoft.com/playwright:v1.15.0focal.
Read more >
playwright: Versions - Openbase
... [BUG] Error: EBUSY: resource busy or locked when using volumes in docker-compose with playwright 1.19.0 and mcr.microsoft.com/playwright:v1.15.0-focal ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found