Github Actions 容器未运行。

6
问题出现在Github Actions中的actions/checkout@v2.1.0 Init Containers之后,整个工作流程开始时发生了错误。
Run actions/checkout@v2.1.0
/usr/bin/docker exec  c30dd34bb8ac19329d0971b0808f9a4440b20a31283dbfb70b5249619e3dc894 sh -c "cat /etc/*release | grep ^ID"
Error response from daemon: Container c30dd34bb8ac19329d0971b0808f9a4440b20a31283dbfb70b5249619e3dc894 is not running

初始化容器日志:

Checking docker version
Clean up resources from previous jobs
Create local container network
Starting job container
/usr/bin/docker pull rafal1137/etlraspbian
Using default tag: latest
latest: Pulling from rafal1137/etlraspbian
31994f9482cd: Pulling fs layer
76b671f957fb: Pulling fs layer
2782b509b7bd: Pulling fs layer
31994f9482cd: Verifying Checksum
31994f9482cd: Download complete
2782b509b7bd: Verifying Checksum
2782b509b7bd: Download complete
76b671f957fb: Verifying Checksum
76b671f957fb: Download complete
31994f9482cd: Pull complete
76b671f957fb: Pull complete
2782b509b7bd: Pull complete
Digest: sha256:c7690eb05c396ab1cda53e2d5a79fa3813f6d2ab673ef42eb3f8d94cbde31ac2
Status: Downloaded newer image for rafal1137/etlraspbian:latest
docker.io/rafal1137/etlraspbian:latest
/usr/bin/docker create --name c2c1009c0f8a45debcf7b67d292ec3fc_rafal1137etlraspbian_5d0ed5 --label 5588e4 --workdir /__w/etlegacy/etlegacy --network github_network_4c8199090d9347ee87e039d67b6a0a4a  -e "HOME=/github/home" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work":"/__w" -v "/home/runner/runners/2.277.1/externals":"/__e":ro -v "/home/runner/work/_temp":"/__w/_temp" -v "/home/runner/work/_actions":"/__w/_actions" -v "/opt/hostedtoolcache":"/__t" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" --entrypoint "tail" rafal1137/etlraspbian "-f" "/dev/null"
WARNING: The requested image's platform (linux/arm) does not match the detected host platform (linux/amd64) and no specific platform was requested
c30dd34bb8ac19329d0971b0808f9a4440b20a31283dbfb70b5249619e3dc894
/usr/bin/docker start c30dd34bb8ac19329d0971b0808f9a4440b20a31283dbfb70b5249619e3dc894
c30dd34bb8ac19329d0971b0808f9a4440b20a31283dbfb70b5249619e3dc894
/usr/bin/docker ps --all --filter id=c30dd34bb8ac19329d0971b0808f9a4440b20a31283dbfb70b5249619e3dc894 --filter status=running --no-trunc --format "{{.ID}} {{.Status}}"
c30dd34bb8ac19329d0971b0808f9a4440b20a31283dbfb70b5249619e3dc894 Up Less than a second
/usr/bin/docker inspect --format "{{range .Config.Env}}{{println .}}{{end}}" c30dd34bb8ac19329d0971b0808f9a4440b20a31283dbfb70b5249619e3dc894
HOME=/github/home
GITHUB_ACTIONS=true
CI=true
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Waiting for all services to be ready

使用的容器

在我的个人电脑上进行本地测试,该容器似乎没有出现任何问题。


你的GitHub Actions workflow.yml配置文件是什么? - GuiFalourd
@GuiFalourd 这个工作流程yml的更改早已过去。但其中一部分看起来像这样。 https://pastebin.com/9Z1cvjM3 - rafal1137
1个回答

11
我认为问题在于您正在构建 linux/arm 平台的镜像,而 Github 正在使用 linux/amd64 平台。

请求的镜像平台(linux/arm)与检测到的主机平台(linux/amd64)不匹配,并且没有请求特定的平台。

请尝试使用 Docker buildxlinux/amd64 平台下构建镜像,或者如果您使用 Docker Compose,则使用 Platform 选项,然后将其推送并重试。

尝试:

docker buildx build --platform linux/amd64 . -t docker.io/username/repo

1
这对我很有用。谢谢Arral!对于其他人,相关命令是 docker buildx build --platform linux/amd64 . -t docker.io/username/repo - Rich Pauloo
1
非常有帮助的问题和答案。这对我也起作用了。如果可以将docker buildx这行代码添加到被接受的答案中,那就太好了,以便其他人也能使用。非常感谢@RichPauloo @arall! - Leah Wasser
对我来说,docker build . --platform linux/amd64 -t docker.io/username/repo 也可以。 - Iman Mahmoudinasab

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接