2

I have created one docker multiarch image with buildx command.

sudo docker buildx build -f build/Dockerfile --platform linux/arm/v7,linux/arm64,linux/amd64 -t uditgaurav/chaos-operator:v3 . --push

build/Dockerfile:

FROM golang:1.13 

ENV GO111MODULE=on \
    CGO_ENABLED=1 

ENV OPERATOR=/usr/local/bin/chaos-operator \
    USER_UID=1001 \
    USER_NAME=chaos-operator

# install operator binary
COPY build/_output/bin/chaos-operator ${OPERATOR}

COPY build/bin /usr/local/bin

RUN  /usr/local/bin/user_setup

RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \
    export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) && \
    GOARM=$(echo ${TARGETPLATFORM} | cut -d / -f3 | cut -c2-)

ENTRYPOINT ["/usr/local/bin/entrypoint"]

USER ${USER_UID}

In dockerhub the images came with diff arch:

But when I ran it in arm clusters it is showing error:

standard_init_linux.go:211: exec user process caused "exec format error"

Docker Version on ARM cluster

Client:
 Version:           19.03.6
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        369ce74a3c
 Built:             Fri Feb 28 23:47:53 2020
 OS/Arch:           linux/arm64
 Experimental:      false

Server:
 Engine:
  Version:          19.03.6
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       369ce74a3c
  Built:            Wed Feb 19 01:06:16 2020
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.3.3-0ubuntu1~18.04.2
  GitCommit:        
 runc:
  Version:          spec: 1.0.1-dev
  GitCommit:        
 docker-init:
  Version:          0.18.0
  GitCommit:  

can anyone help on this?

1 Answer 1

2

Docker multiarch build is not the problem. The problem is that /usr/local/bin/chaos-operator is an linux/amd64 binary and you're trying to run it on linux/arm64.

Sign up to request clarification or add additional context in comments.

3 Comments

I'm also getting the same error while trying to build an image on ARM664. Could you please help me?
I'm guessing your somewhere during your build you're trying to run an executable not compiled for that architecture.
You won't get any help on SO by asking for it in a comment to an answer to another question, even if it is tangentially related. If you want assistance, ask a separate question and put your Dockerfile, description of the issue and any other relevant information in it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.