Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Error with Kaurd "/go/bin/kuard": not found #51

Open
pfilbin90 opened this issue Nov 2, 2023 · 4 comments
Open

Build Error with Kaurd "/go/bin/kuard": not found #51

pfilbin90 opened this issue Nov 2, 2023 · 4 comments

Comments

@pfilbin90
Copy link

pfilbin90 commented Nov 2, 2023

I am on page 24 of Kubernetes up and Running, I am trying to run the example app for the first time.

git clone https://github.com/kubernetes-up-and-running/kuard
cd kuard
docker build -t kuard .

I get the following error...

 => ERROR [stage-1 2/2] COPY --from=build /go/bin/kuard /kuard                                                                                                                      0.0s
------
 > [stage-1 2/2] COPY --from=build /go/bin/kuard /kuard:
------
Dockerfile:31
--------------------
  29 |
  30 |     USER nobody:nobody
  31 | >>> COPY --from=build /go/bin/kuard /kuard
  32 |
  33 |     CMD [ "/kuard" ]
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 1670e558-a5e0-44b8-90d8-a38b092afef2::bvhmpv59qxdu9ec710i1goekg: "/go/bin/kuard": not found

What can I do to resolve?

@this-is-ypi
Copy link

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.

@pfilbin90
Copy link
Author

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.

@this-is-ypi
Copy link

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.

@trouvaillle
Copy link

trouvaillle commented Aug 22, 2024

For who facing this issue on M1,
You can build it with changing Dockerfile a little bit:

2: FROM --platform=linux/amd64 golang:1.12-alpine AS build
28: FROM --platform=linux/amd64 alpine

And run with:

$ docker run --rm -p 8080:8080 --platform linux/amd64 kuard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants