2

I'm trying to run a node app with xvfb-run, here is my Dockerfile

FROM node:lts-alpine

RUN apk --no-cache upgrade && apk add --no-cache chromium coreutils xvfb xvfb-run

ENV CHROME_BIN="/usr/bin/chromium-browser"\
  PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true" \
  UPLOAD_ENV="test"

WORKDIR /app

COPY  package.json .
COPY  .npmrc .

RUN npm install

COPY . .

# EXPOSE 9999

ENTRYPOINT xvfb-run -a npm run dev

I can successfully build the image, but when I run it with docker run, it gets stuck without any log

enter image description here

But when I open an interactive shell and run the ENTRYPOINT command, it works...

enter image description here

How do I fix it?

Littlee
  • 3,791
  • 6
  • 29
  • 61
  • The correct written docke rentrypoint is : **ENTRYPOINT ["xvfb-run", "-a", "npm", "run", "dev"]**, or you can use own entrypoint.sh as bash script and your entrypoint will be **ENTRYPOINT ["/bin/sh entrypoint.sh"]** – Pavel Trzaskalik May 19 '21 at 12:34

1 Answers1

1

You should add --init to docker run, for example:

docker run --init --rm -it $IMAGE$ xvfb-run $COMMAND$

BaiJiFeiLong
  • 3,716
  • 1
  • 30
  • 28