牧云风天 2021-04-07 16:13 采纳率: 0%
浏览 23

树莓派 openfaas 编译执行到第七步报错

pi@raspberrypi:~/functions$ faas-cli build -f ./hello-python.yml


[0] > Building hello-python.
Clearing temporary build folder: ./build/hello-python/
Preparing: ./hello-python/ build/hello-python/function
Building: hello-python: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.1.5 as watchdog
 ---> c164772f02dd
Step 2/31 : FROM --platform=${TARGETPLATFORM:-linux/amd64} python:2.7-alpine
 ---> 8579e446340f
Step 3/31 : ARG TARGETPLATFORM
 ---> Using cache
 ---> e40c331bb33c
Step 4/31 : ARG BUILDPLATFORM
 ---> Using cache
 ---> 0ca2b901990e
Step 5/31 : ARG ADDITIONAL_PACKAGE
 ---> Using cache
 ---> 73a95adc61dd
Step 6/31 : COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
 ---> Using cache
 ---> b682e77f1960
Step 7/31 : RUN chmod +x /usr/bin/fwatchdog
 ---> Running in ccd04dabff43
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 hello-python done in 3.04s.
[0] Worker done.

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

 

 

版本号是:

pi@raspberrypi:~/functions$ faas version
  ___                   _____           ____
 / _ \ _ __   ___ _ __ |  ___|_ _  __ _/ ___|
| | | | '_ \ / _ \ '_ \| |_ / _` |/ _` \___ \
| |_| | |_) |  __/ | | |  _| (_| | (_| |___) |
 \___/| .__/ \___|_| |_|_|  \__,_|\__,_|____/
      |_|

CLI:
 commit:  2cec97955a254358de5443987bedf8ceee272cf8
 version: 0.13.9

Gateway
 uri:     http://127.0.0.1:8080
 version: 0.18.18
 sha:     11ff356ccea32b89b9da556c18305cd7c5ea9ba5


Provider
 name:          faas-swarm
 orchestration: swarm
 version:       0.9.0 
 sha:           e7e845461aa467c0705fe351b6caa025b1abc2ae

  • 写回答

1条回答 默认 最新

  • 码农阿豪@新空间 新星创作者: 前端开发技术领域 2024-07-18 18:41
    关注
    让阿豪来帮你解答,本回答参考chatgpt3.5编写提供,如果还有疑问可以评论或留言
    问题分析: 根据错误提示 "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",可能是由于执行 chmod 命令时出现了格式错误导致构建失败。 解决方法:
    1. 检查 Dockerfile 中的权限设置命令。确保命令格式正确,以及是否有其他构建步骤导致了此错误。
    2. 修改 Dockerfile 中的权限设置命令,可以尝试将权限设置的步骤放置在其他构建步骤之前。
    3. 如果以上方法无效,可以尝试更新 Docker 版本,或者尝试在其他环境中构建。 示例代码:
    FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.1.5 as watchdog
    FROM --platform=${TARGETPLATFORM:-linux/amd64} python:2.7-alpine
    ARG TARGETPLATFORM
    ARG BUILDPLATFORM
    ARG ADDITIONAL_PACKAGE
    COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
    # 修改权限设置步骤的位置
    RUN chmod +x /usr/bin/fwatchdog
    # 其他构建步骤
    # ...
    # 示例 Dockerfile 完整内容
    RUN chmod +x /usr/bin/fwatchdog
    

    通过修改 Dockerfile 中的权限设置命令的位置,可以尝试解决构建过程中出现的权限设置错误。如果问题仍然存在,建议检查其他构建步骤是否会影响到权限设置。

    评论

报告相同问题?