22

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.

3
  • Well, I'm facing the same problem with two libraries, And have no clue what to do. Commented Aug 8, 2021 at 8: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 Commented Aug 8, 2021 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. Commented Aug 8, 2021 at 12:18

3 Answers 3

22
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
5
  • 2
    Note that OP was on Debian. Pretty sure it is just chromium now and not chromium-browser now. See packages.debian.org/search?keywords=chromium
    – Huliax
    Commented May 19, 2022 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 Commented Feb 15, 2023 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 stackoverflow.com/questions/47203812/… Commented Apr 11, 2023 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 Commented May 4, 2023 at 7:30
  • I'm still getting the same error as well. This solution does not work for me. Has anyone solved this?
    – zorrrba
    Commented Mar 14 at 13:23
0

For my case, in Dockerfile, changing from

FROM python:3.11-slim

to

FROM --platform=linux/amd64 python:3.11-slim

solved my issue. Depending on the image you are using you can add --platfrom=linux/amd64 option and give it a try.

https://docs.docker.com/build/guide/multi-platform/

I hope it helps

-2

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.