Quantcast
Channel: Active questions tagged dockerfile - DevOps Stack Exchange
Viewing all articles
Browse latest Browse all 136

bulding docker image for an arm32v7 processor

$
0
0

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 fromFROM 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 imageFROM arm32v7/alpine as build-env# install build-base meta package inside build-env containerRUN apk add --no-cache build-base# change directory to /appWORKDIR /app# copy all files from current directory inside the build-env containerCOPY . .# Compile the source code and generate hello binary executable fileRUN gcc -std=c99 myclient.c -lm -o opc_client# use another container to run the programFROM arm32v7/alpine# copy binary executable to new containerCOPY --from=build-env /app/opc_client /app/opc_clientWORKDIR /app# at last run the programCMD ["/app/opc_client"] 

Viewing all articles
Browse latest Browse all 136

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>