We are trying to run some tasks using puppeteer on Alpine Docker + NodeJS. We used to get below error:
Error: Failed to launch the browser process! spawn /usr/lib/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome ENOENT
Here is the updated Docker Image with a non root user.
FROM alpine
WORKDIR /project
RUN apk add npm
RUN apk add chromium
RUN npm i puppeteer
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
RUN adduser pptruser --disabled-password && adduser -S -g pptruser wheel \
&& mkdir -p /home/pptruser/Downloads /app \
&& chown -R pptruser:wheel /home/pptruser \
&& chown -R pptruser:wheel /app \
&& chown -R pptruser:wheel /project
USER pptruser
Now I get the error when I try to launch the docker container using chrome.json seccomp profile:
Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
I considered trying with custom seccomp profile as suggested here.
Is there a better way? like having some runtime variables to tell chrome to run in non-sandbox mode other than using launch args in puppeteer code?