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

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

How do I fix it?
You should add --init to docker run, for example:
docker run --init --rm -it $IMAGE$ xvfb-run $COMMAND$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With