As the title said, I cannot reproduce this kind of error in any Dockerfiles of mine, after trying to run the Docker Container with
docker run registryName:tag
I'm trying to cross compile from amd64 -> arm6 via gitLab CI
1. Dockerfile:
FROM golang:1.10.2-alpine as builder
WORKDIR /go/src/.../.../dht22
COPY . .
RUN apk add --no-cache alpine-sdk \
&& go get ./... \
&& GOOS=linux CGO_ENABLED=1 go build -a -o app .
FROM arm32v6/alpine:latest
COPY --from=builder /go/src/.../.../dht22/app /app
ENTRYPOINT ["/app"]
2. Dockerfile.arm6 to Cross Compile and run Golang binary on Raspberry Pi:
FROM golang:1.10.2 as builder
WORKDIR /go/src/.../.../dht22
COPY . .
RUN go tool dist list | grep arm \
&& apt-get update \
&& apt-get install -y build-essential gcc-arm-linux-gnueabi \
&& go get ./... \
&& CC=arm-linux-gnueabi-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm go build -a -o app .
FROM arm32v6/alpine:latest
COPY --from=builder /go/src/.../.../dht22/app /app
ENTRYPOINT ["/app"]
What I have tried so far
Adding
!#bin/bash || !#bin/shReinstall Docker
CGO_ENABLED=0isn`t an option cause my Golang dht22 Project has C dependencies
Dockerinfo from Raspberry where my container should run:
Client:
Version: 17.05.0-ce
API version: 1.29
Go version: go1.7.5
Git commit: ....
Built: Thu May 4 22:30:54 2017
OS/Arch: linux/arm
Server:
Version: 17.05.0-ce
API version: 1.29 (minimum version 1.12)
Go version: go1.7.5
Git commit: ....
Built: Thu May 4 22:30:54 2017
OS/Arch: linux/arm
Experimental: false
- Why do I have this error message?
Edit:
A simple Hello World does work in a container with those configs (with 0 dependencies, only "fmt" as package).
My golang project has a third library dependency (https://github.com/d2r2/go-dht) I suspect this throws the error causes of missing dependencies during the build.
Instead of Cross Compiling , Ive build my Image with the 1st Dockerfile on my
Raspberry pi (arm).Container runs about 3h and then exites withCode: 139