skip to Main Content

I am unable to find official docker image for Puppeteer.

There was buildkite repo but it is not longer supporting docker image for puppeteer.

I came across this article but most of the packages mentioned in this article are blocked within my org including chromium executable.

I also used below docker file from https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-puppeteer-in-docker but ran into multiple errors during execution:

FROM node:14-slim

# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
# installs, work.
RUN apt-get update 
    && apt-get install -y wget gnupg 
    && 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 google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 
      --no-install-recommends 
    && rm -rf /var/lib/apt/lists/*

# If running Docker >= 1.13.0 use docker run's --init arg to reap zombie processes, otherwise
# uncomment the following lines to have `dumb-init` as PID 1
# ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_x86_64 /usr/local/bin/dumb-init
# RUN chmod +x /usr/local/bin/dumb-init
# ENTRYPOINT ["dumb-init", "--"]

# Uncomment to skip the chromium download when installing puppeteer. If you do,
# you'll need to launch puppeteer with:
#     browser.launch({executablePath: 'google-chrome-stable'})
# ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

# Install puppeteer so it's available in the container.
RUN npm init -y &&  
    npm i puppeteer 
    # Add user so we don't need --no-sandbox.
    # same layer as npm install to keep re-chowned files from using up several hundred MBs more space
    && groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser 
    && mkdir -p /home/pptruser/Downloads 
    && chown -R pptruser:pptruser /home/pptruser 
    && chown -R pptruser:pptruser /node_modules 
    && chown -R pptruser:pptruser /package.json 
    && chown -R pptruser:pptruser /package-lock.json

# Run everything after as non-privileged user.
USER pptruser

CMD ["google-chrome-stable"]

Got following errors:

Err:1 http://security.debian.org/debian-security stretch/updates InRelease
  Could not resolve 'security.debian.org'
Err:2 http://deb.debian.org/debian stretch InRelease
  Could not resolve 'deb.debian.org'
Err:3 http://deb.debian.org/debian stretch-updates InRelease
  Could not resolve 'deb.debian.org'
Reading package lists...
W: Failed to fetch http://deb.debian.org/debian/dists/stretch/InRelease  Could not resolve 'deb.debian.org'
W: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/InRelease  Could not resolve 'security.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/InRelease  Could not resolve 'deb.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.

Is there any way to get official or any other up-to-date puppeteer docker image ?

2

Answers


  1. This should work , along with this you can attach a node project in which you want to use puppeteer and in its package.json add puppteer dependency and run npm i in dockerfile

    https://dev.to/cloudx/how-to-use-puppeteer-inside-a-docker-container-568c#:~:text=Puppeteer%20is%20a%20Node.,js%20image.

    Login or Signup to reply.
  2. Hidden and deleted answer by @Utopiah worked for me

    The official documentation by Puppeteer is to use their image in the Github Container Registry ghcr.io/puppeteer/puppeteer:latest

    In practice you would use it like so

    Command line

    docker pull ghcr.io/puppeteer/puppeteer:latest
    

    Dockerfile

    FROM ghcr.io/puppeteer/puppeteer:latest
    

    Some more info on using alternative container registries can be found on this answer

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search