You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于ubuntu/python:3.12-24.04_stable镜像构建Docker镜像时出现/bin/sh不存在及exit code:1错误的求助

基于ubuntu/python:3.12-24.04_stable镜像构建Docker镜像时出现/bin/sh不存在及exit code:1错误的求助

我现在在用ubuntu/python:3.12-24.04_stable这个Docker镜像,写了个非常简单的Dockerfile:

FROM ubuntu/python:3.12-24.04_stable

RUN apk update

结果执行构建的时候直接返回了exit code: 1,错误提示说找不到/bin/sh,这可把我搞懵了。

以下是我执行的构建命令和完整的错误输出:

docker build -t test -f Dockerfile .
[+] Building 0.2s (5/5) FINISHED                            docker:desktop-linux
 => [internal] load build definition from Dockerfile                        0.0s
 => => transferring dockerfile: 92B                                         0.0s
 => [internal] load metadata for docker.io/ubuntu/python:3.12-24.04_stable  0.0s
 => [internal] load .dockerignore                                           0.0s
 => => transferring context: 2B                                             0.0s
 => CACHED [1/2] FROM docker.io/ubuntu/python:3.12-24.04_stable             0.0s
 => ERROR [2/2] RUN apk update                                              0.1s
------                                                                           
 > [2/2] RUN apk update:                                                         
0.113 runc run failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory
------
Dockerfile:3
--------------------
   1 |     FROM ubuntu/python:3.12-24.04_stable
   2 |     
   3 | >>> RUN apk update
   4 |     
   5 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c apk update" did not complete successfully: exit code: 1

我之前试过python:3.12和ubuntu:24.04这两个镜像,执行类似的RUN命令都完全没问题,唯独这个ubuntu/python:3.12-24.04_stable一跑RUN就出这种错,难道这个镜像里真的没有/bin/sh吗?

备注:内容来源于stack exchange,提问作者Hashimotto Jo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.13 19:18:09