I managed to build a working docker image on my development laptop, but got an exec format error when I tried to run the docker image on the PC that the container shall run on. My dev PC is an ubuntu 24 with an intel i7 processor. The PC that I want to run the container on is a Linux PREEMT_RT OS with an Cortex A8 processor (arm32v7).

I changed the dockerfile from FROM alpine as build-env to FROM arm32v7/alpine as build-env, but that gives me an error on the RUN apk add --no cache build-base line.

I guess my problem is how to compile the .C-file in an arm32v7 environment. When I try to build the docker image below I get the error:

 => ERROR [build-env 2/5] RUN apk add gcc musl-dev                         1.7s
 > [build-env 2/5] RUN apk add gcc musl-dev:
1.525 exec /bin/sh: exec format error

I appreciate every answer, I'm pretty stuck on this one. Thanks in advance!

# use alpine as base image
FROM arm32v7/alpine as build-env
# install build-base meta package inside build-env container
RUN apk add --no-cache build-base
# change directory to /app
# copy all files from current directory inside the build-env container
COPY . .
# Compile the source code and generate hello binary executable file
RUN gcc -std=c99 myclient.c -lm -o opc_client
# use another container to run the program
FROM arm32v7/alpine
# copy binary executable to new container
COPY --from=build-env /app/opc_client /app/opc_client

# at last run the program
CMD ["/app/opc_client"] 


Your Answer

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

Browse other questions tagged or ask your own question.