17

I am Running docker on an M1 Macbook Pro , here i am using this docker script

FROM node:current-buster
# Create and set user
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt-get update && apt install -y ./google-chrome-stable_current_amd64.deb

This throws an error google-chrome-stable:amd64 : Depends: libasound2:amd64 (>= 1.0.16) but it is not installable

and same for other dependencies

I have tried various ways:

  1. changing base image
  2. changing the installation step to
apt-get install -y wget gnupg ca-certificates procps libxss1 && 
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 

(This gives an error unable to locate package)

The script runs on a linux machine but for m1 mac it doesnt work.

I actually wanted to run puppeteer inside docker for which i am trying to install chrome incase there is an another way around.

Srinjoy Choudhury
  • 622
  • 1
  • 4
  • 19
  • Well, I'm facing the same problem with two libraries, And have no clue what to do. – Mohammad.Kaab Aug 08 '21 at 08:56
  • @mohammad.kaab which libraries i have figured out some ways to actually make this work infact the workaround for this is nothing but installing chromium which is available for arm and seems to work perfectly fine – Srinjoy Choudhury Aug 08 '21 at 12:00
  • Thanks, I have solved the problem by changing the version of docker-compose file to 3 and add platform: linux/x86_64 to the service. I actually had a problem with running the docker composer file. – Mohammad.Kaab Aug 08 '21 at 12:18

2 Answers2

16
docker buildx build --platform=linux/amd64

This allows us to build the image atleast. Not sure if running it would produce the same result on M1 machine but atleast the image is built

EDIT::

so chrome has no arm image and that was the main cause for this problem changing it to chromium on base ubuntu 18.04 seems to work fine

FROM ubuntu:18.04
RUN apt-get install -y chromium-browser
Srinjoy Choudhury
  • 622
  • 1
  • 4
  • 19
  • 2
    Note that OP was on Debian. Pretty sure it is just `chromium` now and not `chromium-browser` now. See https://packages.debian.org/search?keywords=chromium – Huliax May 19 '22 at 17:30
  • 1
    well, now working for me, I tried above Dockerfile with command `docker buildx build --platform=linux/amd64 -t my_image .` on Mac with M1 and on line `RUN apt-get install -y chromium-browser` occurs error `Package 'chromium-browser' has no installation candidate`. BTW `chromium` doest work too – Grzegorz Dev Feb 15 '23 at 15:20
  • 1
    `RUN apt-get install -y chromium-browser` produces exactly error `Package chromium-browser is not available, but is referred to by another package.` as in https://stackoverflow.com/questions/47203812/package-chromium-browser-has-no-installation-candidate – Paul Verest Apr 11 '23 at 16:40
  • 1
    I'm still getting the same error. I want to run pyppeteer in airflow so I'm using apache/airflow:2.6.0 as a base image and running into this problem – Omair Nabiel May 04 '23 at 07:30
-1

It should work on both debian and ubuntu, try first to run sudo apt update after that it was able to install arm build of chromium.