0

my kubernetes is based on arm,with kubernetes1.22.4

my faas-cli command:

faas-cli build -f ./add.yml

the response code :

[0] > Building add.
Clearing temporary build folder: ./build/add/
Preparing: ./add/ build/add/function
Building: myw/add:latest with python template. Please wait..
Sending build context to Docker daemon  8.192kB
Step 1/31 : FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.2.0 as watchdog
 ---> 6f97aa96da81
Step 2/31 : FROM --platform=${TARGETPLATFORM:-linux/amd64} python:2.7-alpine
 ---> 8579e446340f
Step 3/31 : ARG TARGETPLATFORM
 ---> Using cache
 ---> a75f5a062540
Step 4/31 : ARG BUILDPLATFORM
 ---> Using cache
 ---> c90a8309e851
Step 5/31 : ARG ADDITIONAL_PACKAGE
 ---> Using cache
 ---> 4ee3e6fab2a3
Step 6/31 : COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
 ---> Using cache
 ---> 33d972637c65
Step 7/31 : RUN chmod +x /usr/bin/fwatchdog
 ---> Running in 6204e8546454
standard_init_linux.go:219: exec user process caused: exec format error
The command '/bin/sh -c chmod +x /usr/bin/fwatchdog' returned a non-zero code: 1
[0] < Building add done in 0.54s.
[0] Worker done.

Total build time: 0.54s
Errors received during build:
- [add] received non-zero exit code from build, error: The command '/bin/sh -c chmod +x /usr/bin/fwatchdog' returned a non-zero code: 1

then can someone tell me the currect way to build a function with arm in openfaas,and why this happened,did i do someting wrong?

  • Your target platform is amd64 which I don't believe is compatible with ARM processor that your workers are running. – lance.johnsn Jan 10 '22 at 20:19
  • yes,you are right. So i tried a another way with docker buildx. the command is :DOCKER_BUILDKIT=1 faas-cli build -f function.yml --no-cache --build-arg platform=linux/arm64/v8 – lunatic-myw Jan 12 '22 at 04:35
  • But could you tell me why it works? – lunatic-myw Jan 12 '22 at 04:35
  • The instruction sets are different between the two platforms. Your workers are ARM processors. As a result the executables, built for one platform, do not work on the other. Your argument specifying the platform ensures the executables match the processor on the workers. – lance.johnsn Jan 19 '22 at 18:13
  • Running into the same issues as the OP. What should one set their build flag.. these do not seem to fix the running containers: `buildplatform=arm64 buildarch=arm64 targetos=linux targetarch=amd64` – Cmag Dec 12 '22 at 03:55

0 Answers0