首页 > 解决方案 > Error: BrowserType.launch: Protocol error (Browser.getVersion): Browser closed when running codeceptjs docker image thru Dockerfile

问题描述

FROM codeceptjs/codeceptjs:latest
# Set working directory
WORKDIR /usr/app
# Copy source code
COPY package.json /usr/app
COPY package-lock.json /usr/app
COPY . /usr/app
# Environment variables
ENV BASE_URL="Local Https URL"
ENV PARALLEL_RUN=false
ENV TAG=int
RUN rm -rf node_modules
RUN npm install
# Run tests
RUN npm run codeceptjs

I have written above docker file when I am pulling the latest docker image of Codeceptjs. When I am trying the Build the image then I am getting error when test execution starts. Error is:

#12 6.636 [pid=286][err][286:286:1004/055308.159970:ERROR:browser_main_loop.cc(1412)] Unable to open X display.
#12 6.636 ============================================================    
#12 6.636 Note: use DEBUG=pw:api environment variable to capture Playwright logs.
#12 6.636   browserType.launch: Protocol error (Browser.getVersion): Browser closed.
#12 6.636   ==================== Browser output: ====================     
#12 6.636   <launching> /ms-playwright/chromium-888113/chrome-linux/chrome --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-background 

标签: dockerdockerfilecodeceptjs

解决方案


推荐阅读