嗨伙计们需要帮忙。
我创建了一个自定义的码头映像并将其推送到停靠中心,但是当我在CI/CD中运行它时,它会给出这个错误。
exec /usr/bin/sh: exec format error
其中:
Dockerfile
FROM ubuntu:20.04
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-get install -y python3-pip
RUN pip3 install robotframework
.gitlab-ci.yml
robot-framework:
image: rethkevin/rf:v1
allow_failure: true
script:
- ls
- pip3 --version
输出
Running with gitlab-runner 15.1.0 (76984217)
on runner zgjy8gPC
Preparing the "docker" executor
Using Docker executor with image rethkevin/rf:v1 ...
Pulling docker image rethkevin/rf:v1 ...
Using docker image sha256:d2db066f04bd0c04f69db1622cd73b2fc2e78a5d95a68445618fe54b87f1d31f for rethkevin/rf:v1 with digest rethkevin/rf@sha256:58a500afcbd75ba477aa3076955967cebf66e2f69d4a5c1cca23d69f6775bf6a ...
Preparing environment
00:01
Running on runner-zgjy8gpc-project-1049-concurrent-0 via 1c8189df1d47...
Getting source from Git repository
00:01
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in /builds/reth.bagares/test-rf/.git/
Checking out 339458a3 as main...
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:00
Using docker image sha256:d2db066f04bd0c04f69db1622cd73b2fc2e78a5d95a68445618fe54b87f1d31f for rethkevin/rf:v1 with digest rethkevin/rf@sha256:58a500afcbd75ba477aa3076955967cebf66e2f69d4a5c1cca23d69f6775bf6a ...
exec /usr/bin/sh: exec format error
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
对此有什么想法来解决错误吗?
发布于 2022-08-09 01:46:25
问题是,您为arm64/v8构建了这个映像--但是您的跑步者使用的是不同的架构。
如果你跑:
docker image inspect rethkevin/rf:v1
您将在输出中看到这一点:
...
"Architecture": "arm64",
"Variant": "v8",
"Os": "linux",
...
尝试从您的GitLab CI运行程序构建并推送您的图像,这样图像的体系结构将与您的跑步者的架构相匹配。
或者,您可以使用构建多个体系结构使用docker buildx
。或者,您还可以在ARM架构上运行GitLab运行程序,这样它就可以运行构建它的体系结构的映像。
发布于 2022-11-03 00:01:11
在我的例子中,我使用buildx构建它。
docker buildx build --platform linux/amd64 -f ./Dockerfile -t image .
然而,问题就在AWS lambda中。
https://stackoverflow.com/questions/73285601
复制相似问题