Open pfilbin90 opened 1 year ago
Hi. I faced the same problem. In my case, I use Mac with M1 and in the Dockerfile ARCH is set to 'amd64' so at stage 1 of the build the go-file is placed in the directory '/go/bin/linux-amd64/'. First I tried to change COPY command in the Dockerfile but I got a new error. So as a next step, I changed ARCH var to 'arm64' and now it works fine.
Hi. I faced the same problem. In my case, I use Mac with M1 and in the Dockerfile ARCH is set to 'amd64' so at stage 1 of the build the go-file is placed in the directory '/go/bin/linux-amd64/'. First I tried to change COPY command in the Dockerfile but I got a new error. So as a next step, I changed ARCH var to 'arm64' and now it works fine.
Thank you so much! I am using a Macbook pro with the M1 chip, so yes that's likely one part of my issue. I tried to update ARCH=arm64
in all the areas of the app code, I notice there are 24 instances of it. However, again when I run docker build -t kuard .
now I get the following error:
------
Dockerfile:25
--------------------
23 |
24 | # Do the build. Script is part of incoming sources.
25 | >>> RUN build/build.sh
26 |
27 | # STAGE 2: Runtime
--------------------
ERROR: failed to solve: process "/bin/sh -c build/build.sh" did not complete successfully: exit code: 1
Any ideas on this one? I wonder if I just need to nuke the repo and reclone it and try again.
I'm not sure you need to change ARCH in all places, because it is set as an env variable by the Dockerfile. In my case, I changed only in the Dockerfile. I didn't face the problem you got, so I have nothing to say about it.
For who facing this issue on M1,
You can build it with changing Dockerfile
a little bit:
- 2: FROM golang:1.12-alpine AS build
+ 2: FROM --platform=linux/amd64 golang:1.12-alpine AS build
- 28: FROM alpine
+ 28: FROM --platform=linux/amd64 alpine
And run with:
$ docker run --rm -p 8080:8080 --platform linux/amd64 kuard
for m1 just change to this: ENV ARCH=arm64
I am on page 24 of Kubernetes up and Running, I am trying to run the example app for the first time.
I get the following error...
What can I do to resolve?