score:5
installing puppeteer npm package directly won't work for some reason and sadly the official puppeteer documentation in github is not compatible with arm64 architecture.
this is how i've prepared my dockerfile:
from node:16
run apt-get update \
&& apt-get install -y chromium \
fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
--no-install-recommends
user node # non-root user that comes with `node` images.
workdir /app
copy --chown=node package.json .
copy --chown=node package-lock.json .
env puppeteer_skip_chromium_download true
env puppeteer_executable_path /usr/bin/chromium
run npm install
copy --chown=node . /app
the dockerfile as it is configured is native to apple silicon (linux/arm64) as well as native for amd64 (linux/amd64) architectures.
you also must pass --no-sandbox
argument to the browser on your code:
export async function createbrowserinstance(): promise<puppeteer.browser> {
return await puppeteer.launch({
args: ['--no-sandbox'], // required.
headless: true,
});
}
the extra flag disables the browser's dev sandboxing, so make sure to access only trusted pages. otherwise it's fine. please, somebody from the future, please feel free to edit this answer or comment how to get rid of the --no-sandbox
argument.
Source: stackoverflow.com
Related Query
- How to run Puppeteer on a Docker container on a MacOS Apple Silicon M1 arm64 host
- how to run amd64 docker images on arm64 host platform
- how to run docker on apple silicon (m1)
- How to run container in a remote docker host with Jenkins
- How to run application from docker container from host OS?
- how to run a command in host before entering docker container in github ci
- How to run local host machine script with arguments in a docker container
- how to run arm64 docker images on amd64 host platform
- How to access a port on the host machine when running docker container on MacOS with --network=host?
- How to connect to a service running on docker container from withing host MacOS machine?
- How to run an amd64 docker images on arm64 host
- How can I run VS Code's Extension Development Host in a Docker container to test my vscode extension?
- How to run virus scanner script from host machine from Docker container
- How To run from host machine bash script inside docker container and remain in bash in container
- Run puppeteer headful in docker container when the docker host is windows
- How to run rails app in docker container with nginx running on host machine?
- How to install / run service or command on host machine from a docker container
- How to run a bash script in the host from a docker container and get the result
- How to run Shellscript from a docker container which is on host
- Run an amd64 docker-in-docker (dind) container on an arm64 host (Apple silicon machine)
- How to run selenium java testcases and copy test framework from Mac host to Ubutnu Docker container
- How to run Python Selenium with Chrome GUI on Ubuntu Container with Browserfull (NOT Browserless) on Docker on a WIndows 10 host PC?
- How to mount a host directory in a Docker container
- How to access host port from docker container
- How to get the IP address of the docker host from inside a docker container
- How can I run bash in a new container of a docker image?
- How to run Nginx within a Docker container without halting?
- How to show the run command of a docker container
- How to run shell script on host from docker container?
- How to connect to a docker container from outside the host (same network) [Windows]
More Query from same tag
- Settings to Windows Firewall to allow Docker for Windows to share drive
- Relative path binding in docker for volumes in macOS does fail
- How to separate application config from AP in container on Kuberetes?
- Connecting to mysql container from host
- docker container starts new container after stopping or removing
- Using Jib Maven Plugin to pull as base image an windows nanoserver eclipse-temurin:8 gives error blob unknown to registry
- Virtualize my VPS
- Does the OCF spec mean that Docker is no longer Linux centric?
- docker run hello-world fails, stderr: permission denied
- Docker-compose shared volume between containers but that has a path in host
- Rails Docker Image Deployed on Kubernetes Cluster. Safe to run rake:db:migrate on every Dockerfile build?
- Configure Dockerfile to set AWS configurations
- Is it possible to integrate SonarQube, Jenkins and GitLab (all in dockers)?
- ValueError: Missing staticfiles manifest entry on Heroku with Docker, django-pipeline, whitenoise
- Jenkins Docker Swarm Plugin within Swarm
- Docker on Windows Server 2016 & microsoft-build-tools
- Can Intellij be used with a Visual-Studio-Code style docker devcontainer?
- cant ping to a linux conainer running on windows
- What Visual Studio Component contains the Public Assemblies?
- Build options issue when publishing docker image
- Does docker still doesn't run on virtual servers hosted by Strato now?
- Can all docker swarm instances run on same machine?
- Why do I still getting error, Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock?
- How restore a postgres database with fig?
- Installing HyperLedger on Win10 with WSL - DOCKER Blocker
- From Docker-compose php-apache exit with message exited with code 0
- Converting docker-compose file to bash to auto run tests
- Execute PHP script via supervisor in docker
- How to partition web application in Docker
- Suggested command to eval "docker-machine env default" output fails on Cygwin