The command '/bin/sh -c apk --update add git build-base' returned a non-zero code: 1 #15

Closed
opened 2025-11-20 04:18:43 -05:00 by saavagebueno · 6 comments
Owner

Originally created by @Wibbbs on GitHub (Nov 30, 2019).

Trying to build on a raspberry pi. Cloned the repo to a local directory and ran the arm64 build command from you documentation. This is usally the error I see when the architecture is not right but I am pretty sure Raspberry Pi3 is Arm8 64. Output is below.

docker build -t qmcgaw/ddns-updater \
--build-arg BASE_IMAGE_BUILDER=arm64v8/golang \
--build-arg BASE_IMAGE=arm64v8/alpine \
--build-arg GOARCH=arm64 \
.

Sending build context to Docker daemon   98.3kB
Step 1/26 : ARG BASE_IMAGE_BUILDER=golang
Step 2/26 : ARG BASE_IMAGE=alpine
Step 3/26 : ARG ALPINE_VERSION=3.10
Step 4/26 : ARG GO_VERSION=1.13
Step 5/26 : FROM ${BASE_IMAGE_BUILDER}:${GO_VERSION}-alpine${ALPINE_VERSION} AS builder
1.13-alpine3.10: Pulling from arm64v8/golang
8bfa91304040: Pull complete
d523c651118b: Pull complete
a46c40489613: Pull complete
ce81c8f18008: Pull complete
232d38dd15d6: Pull complete
Digest: sha256:9244aa9c3b34272a57bb0e1cbacc571c7eb3c9113813e81fe430a372f308c2f2
Status: Downloaded newer image for arm64v8/golang:1.13-alpine3.10
 ---> 51f17d606bde
Step 6/26 : ARG GOARCH=amd64
 ---> Running in 00dfac987b27
Removing intermediate container 00dfac987b27
 ---> e17e30f89543
Step 7/26 : ARG GOARM=
 ---> Running in fce99676fed6
Removing intermediate container fce99676fed6
 ---> a975b179c146
Step 8/26 : RUN apk --update add git build-base
 ---> Running in dc2ad1bf6d48
standard_init_linux.go:211: exec user process caused "exec format error"
The command '/bin/sh -c apk --update add git build-base' returned a non-zero code: 1
Originally created by @Wibbbs on GitHub (Nov 30, 2019). Trying to build on a raspberry pi. Cloned the repo to a local directory and ran the arm64 build command from you documentation. This is usally the error I see when the architecture is not right but I am pretty sure Raspberry Pi3 is Arm8 64. Output is below. ``` docker build -t qmcgaw/ddns-updater \ --build-arg BASE_IMAGE_BUILDER=arm64v8/golang \ --build-arg BASE_IMAGE=arm64v8/alpine \ --build-arg GOARCH=arm64 \ . Sending build context to Docker daemon 98.3kB Step 1/26 : ARG BASE_IMAGE_BUILDER=golang Step 2/26 : ARG BASE_IMAGE=alpine Step 3/26 : ARG ALPINE_VERSION=3.10 Step 4/26 : ARG GO_VERSION=1.13 Step 5/26 : FROM ${BASE_IMAGE_BUILDER}:${GO_VERSION}-alpine${ALPINE_VERSION} AS builder 1.13-alpine3.10: Pulling from arm64v8/golang 8bfa91304040: Pull complete d523c651118b: Pull complete a46c40489613: Pull complete ce81c8f18008: Pull complete 232d38dd15d6: Pull complete Digest: sha256:9244aa9c3b34272a57bb0e1cbacc571c7eb3c9113813e81fe430a372f308c2f2 Status: Downloaded newer image for arm64v8/golang:1.13-alpine3.10 ---> 51f17d606bde Step 6/26 : ARG GOARCH=amd64 ---> Running in 00dfac987b27 Removing intermediate container 00dfac987b27 ---> e17e30f89543 Step 7/26 : ARG GOARM= ---> Running in fce99676fed6 Removing intermediate container fce99676fed6 ---> a975b179c146 Step 8/26 : RUN apk --update add git build-base ---> Running in dc2ad1bf6d48 standard_init_linux.go:211: exec user process caused "exec format error" The command '/bin/sh -c apk --update add git build-base' returned a non-zero code: 1 ```
Author
Owner

@qdm12 commented on GitHub (Nov 30, 2019):

Hi there, Thanks for posting here.

From this forum thread it seems like the Raspberry Pi 3 hardware is indeed ARM64v8 but the operating systems are 32 bit most of the time. So you have to build it for ARM32v7.

On the other hand, I'm setting up a build pipeline to build images for all platforms automatically (here), it should be done today so that you can docker pull qmcgaw/ddns-updater without taking care of your cpu architecture. You can join the Slack channel I'll post there when it's done (probably today).

@qdm12 commented on GitHub (Nov 30, 2019): Hi there, Thanks for posting here. From [this forum thread](https://www.raspberrypi.org/forums/viewtopic.php?t=140572) it seems like the Raspberry Pi 3 hardware is indeed ARM64v8 but the operating systems are 32 bit most of the time. So you have to build it for ARM32v7. On the other hand, I'm setting up a build pipeline to build images for all platforms automatically ([here](https://github.com/qdm12/ddns-updater/pull/21)), it should be done today so that you can `docker pull qmcgaw/ddns-updater` without taking care of your cpu architecture. You can join the Slack channel I'll post there when it's done (probably today).
Author
Owner

@Wibbbs commented on GitHub (Nov 30, 2019):

Awesome thank so much. I will try your new build when it is ready.

@Wibbbs commented on GitHub (Nov 30, 2019): Awesome thank so much. I will try your new build when it is ready.
Author
Owner

@Wibbbs commented on GitHub (Nov 30, 2019):

One more question where is the slack channel?

@Wibbbs commented on GitHub (Nov 30, 2019): One more question where is the slack channel?
Author
Owner

@qdm12 commented on GitHub (Nov 30, 2019):

It's at the Slack icon in the readme, maybe a bit too hidden indeed haha. Link is here too

@qdm12 commented on GitHub (Nov 30, 2019): It's at the Slack icon in the readme, maybe a bit too hidden indeed haha. Link is [here too](https://join.slack.com/t/qdm12/shared_invite/enQtODMwMDQyMTAxMjY1LTU1YjE1MTVhNTBmNTViNzJiZmQwZWRmMDhhZjEyNjVhZGM4YmIxOTMxOTYzN2U0N2U2YjQ2MDk3YmYxN2NiNTc)
Author
Owner

@qdm12 commented on GitHub (Nov 30, 2019):

Unfortunately, it turns out cross compiling Docker images is not possible because of Go (yep very odd!).

As soon as I run it (with QEMU) for another platform (ARM or S390x or anything) than my native architecture amd64, my builds hangs on go build -x ... every time at the same line

cp $WORK/b181/_pkg_.a /root/.cache/go-build/c1/c19fe58cdd26770caf5c2e3ce18484fd2ace2e15cf61105e7b70fb450656b7b8-d

And the build will never finish (waited one hour just to be sure). I tried to fiddle with multiple Dockerfiles and glue everywhere but the only solution seems to be to cross build the Go binaries on the native architecture (using go build features) and copy it to a final Scratch image.

Now to do that I need to replace sqlite (which I wanted to do for a long time) with a Go written database thing. I'll link the PR to this issue.

So for now, use:

docker build -t qmcgaw/ddns-updater https://github.com/qdm12/ddns-updater.git
@qdm12 commented on GitHub (Nov 30, 2019): Unfortunately, it turns out cross compiling Docker images is not possible because of Go (yep very odd!). As soon as I run it (with QEMU) for another platform (ARM or S390x or anything) than my native architecture amd64, my builds hangs on `go build -x ...` every time at the same line ```sh cp $WORK/b181/_pkg_.a /root/.cache/go-build/c1/c19fe58cdd26770caf5c2e3ce18484fd2ace2e15cf61105e7b70fb450656b7b8-d ``` And the build will never finish (waited one hour just to be sure). I tried to fiddle with multiple Dockerfiles and glue everywhere but the only solution seems to be to cross build the Go binaries on the native architecture (using `go build` features) and copy it to a final Scratch image. Now to do that I need to replace sqlite (which I wanted to do for a long time) with a Go written database thing. I'll link the PR to this issue. So for now, use: ```sh docker build -t qmcgaw/ddns-updater https://github.com/qdm12/ddns-updater.git ```
Author
Owner

@qdm12 commented on GitHub (Nov 30, 2019):

Yet another twist, it works (takes ages) and builds it for ARM64v8 (not you) and ARM32v7 (you) although it fails for ARM32v6, S390X and other strange architectures. It's building it now on Travis CI (here, expect an hour 😆 ) and then you should be able to peacefully docker pull qmcgaw/ddns-updater 😄

@qdm12 commented on GitHub (Nov 30, 2019): Yet another twist, it works (takes ages) and builds it for ARM64v8 (not you) and ARM32v7 (you) although it fails for ARM32v6, S390X and other strange architectures. It's building it now on Travis CI ([here](https://travis-ci.org/qdm12/ddns-updater/builds/619088617), expect an hour 😆 ) and then you should be able to peacefully `docker pull qmcgaw/ddns-updater` 😄
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ddns-updater#15