Ask Your Question
3

What is the method to execute Puppeteer on a Docker container hosted on a MacOS Apple Silicon M1 arm64 machine?

asked 2022-01-04 11:00:00 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-05-13 06:00:00 +0000

david gravatar image
  1. Install Docker on your MacOS Apple Silicon M1 arm64 machine.

  2. Pull a Docker image that supports Puppeteer and is compatible with the arm64 architecture. You can use the official Node.js Docker image with arm64 support:

docker pull node:16-alpine3.14
  1. Create a Dockerfile for your Puppeteer project. Here is an example:
# Start with the official Node.js Docker image with arm64 support
FROM node:16-alpine3.14

# Set the working directory to /app
WORKDIR /app

# Copy the package.json and package-lock.json files to /app
COPY package*.json ./

# Install the dependencies
RUN npm install

# Copy the rest of the files to /app
COPY . .

# Expose port 3000 for the Puppeteer server
EXPOSE 3000

# Set the command to start the Puppeteer server
CMD [ "npm", "start" ]
  1. Build the Docker image from the Dockerfile:
docker build -t my-puppeteer-app .
  1. Run the Docker container:
docker run -p 3000:3000 my-puppeteer-app

This will start the Puppeteer server inside the Docker container and map port 3000 to port 3000 on your MacOS Apple Silicon M1 arm64 machine. You can access the Puppeteer server by opening a web browser and navigating to http://localhost:3000.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-01-04 11:00:00 +0000

Seen: 10 times

Last updated: May 13 '21