Unable to Run JS Report Single Exe file in Linux Docker
-
I'm trying to run JS Report Single Exe file in Linux Docker. Used Java Spring Boot API for triggering an shell script command. Docker file contains the following commands.
# https://jsreport.net/learn/dotnet-local#docker RUN apt-get update && apt-get install -y --no-install-recommends libgconf-2-4 gnupg git curl wget ca-certificates libgconf-2-4 && \ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \ apt-get update && \ apt-get install -y lsb-release google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst libxtst6 libxss1 --no-install-recommends ENV chrome_launchOptions_executablePath google-chrome-stable ENV chrome_launchOptions_args --no-sandbox,--disable-dev-shm-usage,--single-process,--no-zygote RUN mkdir -p /unmanaged/bin/jsreport && curl -fsSL https://github.com/jsreport/jsreport/releases/download/2.11.0/jsreport-linux.tar.gz | tar zxC /unmanaged/bin/jsreport
I'm getting the following error while executing the shell command.
A critical error occurred while trying to execute the render command (2). Failed to launch chrome! /tmp/jsreport/compile/jsreport-2.11.0-BkQPrWToP/chrome/chrome: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md (1). caused by error (2): -> stack Error: at onCriticalError (/snapshot/jsreport/node_modules/jsreport-cli/lib/commands/render.js:302:19) at /snapshot/jsreport/node_modules/jsreport-cli/lib/commands/render.js:298:12 caused by error (1): -> meta = {"logged":true} -> stack Error: Failed to launch chrome! /tmp/jsreport/compile/jsreport-2.11.0-BkQPrWToP/chrome/chrome: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md at onClose (/snapshot/jsreport/node_modules/puppeteer/lib/Launcher.js:348:14) at Interface.<anonymous> (/snapshot/jsreport/node_modules/puppeteer/lib/Launcher.js:337:50) at Interface.emit (events.js:323:22) at Interface.close (readline.js:409:8) at Socket.onend (readline.js:187:10) at Socket.emit (events.js:323:22) at endReadableNT (_stream_readable.js:1204:12) at processTicksAndRejections (internal/process/task_queues.js:84:21)
-
Hi, what is your docker base image?
-
Debian needs two additional deps to be installed. The whole part looks like this:
# install chrome with deps, see https://github.com/jsreport/jsreport/blob/master/docker/full/Dockerfile RUN apt-get update && apt-get install -y --no-install-recommends libgconf-2-4 gnupg git curl wget ca-certificates libgconf-2-4 && \ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \ apt-get update && \ apt-get install -y lsb-release google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst libxtst6 libxss1 --no-install-recommends # debian needs this additional install RUN apt-get install -y libx11-6 libx11-xcb1 ENV chrome_launchOptions_executablePath google-chrome-stable ENV chrome_launchOptions_args --no-sandbox,--disable-dev-shm-usage,--single-process,--no-zygote
-
Thanks for the Reply. But we just updated the Docker File. The file will be like
RUN apt-get update && apt-get install -y --no-install-recommends libgconf-2-4 gnupg git curl wget ca-certificates && \ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \ apt-get update && \ apt-get install -y lsb-release google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst libxtst6 libxss1 --no-install-recommends && \ apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 \ libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 \ libxrender1 ca-certificates fonts-liberation libappindicator1 libnss3 xdg-utils ENV chrome_launchOptions_executablePath google-chrome-stable ENV chrome_launchOptions_args --no-sandbox,--disable-dev-shm-usage,--single-process,--no-zygote
It works well in my docker desktop. But not working in aws EC2 instance. Can you pls help me with that. The error is like,
UnhandledPromiseRejectionWarning: Error: EFAULT: bad address in system call argument, read (node:556) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:556) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.