aws-codebuild-docker-images icon indicating copy to clipboard operation
aws-codebuild-docker-images copied to clipboard

Can't build 5.0 image on M1 Mac

Open aterreno opened this issue 3 years ago • 5 comments

Hi, this issue https://github.com/aws/aws-codebuild-docker-images/issues/439 needs reopening, or rather, it was misunderstood. I can't build the 5.0 image locally (on a mac m1, if that matters)

 => ERROR [tools  3/13] RUN set -ex     && wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add -     && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/s  2.2s
------
 > [tools  3/13] RUN set -ex     && wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add -     && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google.list     && apt-get update     && apt-get install -y google-chrome-stable     && google-chrome --version:
#9 0.286 + wget -q -O - https://dl.google.com/linux/linux_signing_key.pub
#9 0.286 + apt-key add -
#9 0.327 Warning: apt-key output should not be parsed (stdout is not a terminal)
#9 0.664 OK
#9 0.668 + echo deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
#9 0.668 + tee /etc/apt/sources.list.d/google.list
#9 0.669 deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
#9 0.669 + apt-get update
#9 0.891 Hit:1 http://archive.canonical.com/ubuntu focal InRelease
#9 0.912 Hit:2 http://ports.ubuntu.com/ubuntu-ports focal InRelease
#9 0.955 Hit:3 http://ppa.launchpad.net/git-core/ppa/ubuntu focal InRelease
#9 1.012 Hit:4 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
#9 1.030 Get:5 http://dl.google.com/linux/chrome/deb stable InRelease [1811 B]
#9 1.145 Hit:6 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
#9 1.221 Get:7 http://dl.google.com/linux/chrome/deb stable/main amd64 Packages [1101 B]
#9 1.241 Hit:8 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
#9 1.302 Fetched 2912 B in 1s (4879 B/s)
#9 1.302 Reading package lists...
#9 1.692 + apt-get install -y google-chrome-stable
#9 1.716 Reading package lists...
#9 2.076 Building dependency tree...
#9 2.152 Reading state information...
#9 2.201 E: Unable to locate package google-chrome-stable
------
executor failed running [/bin/sh -c set -ex     && wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add -     && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google.list     && apt-get update     && apt-get install -y google-chrome-stable     && google-chrome --version]: exit code: 100

If I comment out the google-chrome bit on the dockerfile everything is fine.

aterreno avatar Jun 15 '21 14:06 aterreno

I see now progressing the install I get this

#11 52.97
#11 52.97 2021-06-15 14:40:33 (593 KB/s) - ‘amazon-ssm-agent.deb’ saved [31597536/31597536]
#11 52.97
#11 52.98 + dpkg -i amazon-ssm-agent.deb
#11 53.03 dpkg: error processing archive amazon-ssm-agent.deb (--install):
#11 53.03  package architecture (amd64) does not match system (arm64)
#11 53.04 Errors were encountered while processing:
#11 53.04  amazon-ssm-agent.deb
------
executor failed running [/bin/sh -c set -ex     && mkdir /tmp/ssm     && cd /tmp/ssm     && wget https://s3.amazonaws.com/amazon-ssm-us-east-1/2.3.1644.0/debian_amd64/amazon-ssm-agent.deb     && dpkg -i amazon-ssm-agent.deb]: exit code: 1

so perhaps the issue is really my M1 architecture, but it's not clear from the previous error output?

I'll try to build on Linux, no big deal

aterreno avatar Jun 15 '21 14:06 aterreno

You may be able to build it using the platform flag, e.g.: --platform linux/amd64

josephvusich avatar Jul 08 '21 19:07 josephvusich

Thanks but if I do that I won't be able to run them on my mac right, which was the whole point of this exercise.

I am sort of giving up on using docker on mac M1 right now, it adds too much complexity to my workflow.

I started using https://bigdevbox.com/ and I can build there docker on the target architecture without too much hassle.

Thanks for your help

aterreno avatar Jul 09 '21 08:07 aterreno

Thanks but if I do that I won't be able to run them on my mac right

Docker on Mac uses the Apple Hypervisor Framework, and is capable of both building and running cross-platform images: https://docs.docker.com/docker-for-mac/apple-silicon/

josephvusich avatar Jul 09 '21 21:07 josephvusich

--platform linux/amd64

Adding this flag and running the following made me build successfully, thanks @josephvusich :

docker build -t aws/codebuild/standard:5.0 . --platform linux/amd64

mepc36 avatar Apr 11 '22 18:04 mepc36

Running this on M1 docker build -t aws/codebuild/standard:5.0 . --platform linux/amd64

Been running for 5+ hours. Any update on this issue?

deshruch avatar Apr 13 '23 20:04 deshruch

Stuck at this stage when left to run on the weekend: image

deshruch avatar Apr 17 '23 14:04 deshruch

Moving all Mac build failures reported to one issue: https://github.com/aws/aws-codebuild-docker-images/issues/575.

subinataws avatar Apr 22 '23 00:04 subinataws