最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Docker image ubuntupython:3.12-24.04_stable exit code:1 with binsh - Stack Overflow

programmeradmin1浏览0评论

I'm taking a docker image, ubuntu/python:3.12-24.04_stable.

Dockerfile

FROM ubuntu/python:3.12-24.04_stable

RUN apk update

When I build this simple Dockerfile, I get exit code: 1. Is this docker image not available /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

I've tried using python:3.12 and ubuntu:24.04 and all of them are working fine but the image only ubuntu/python:3.12-24.04_stable is returning the error to have RUN or so.

I'm taking a docker image, ubuntu/python:3.12-24.04_stable.

Dockerfile

FROM ubuntu/python:3.12-24.04_stable

RUN apk update

When I build this simple Dockerfile, I get exit code: 1. Is this docker image not available /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

I've tried using python:3.12 and ubuntu:24.04 and all of them are working fine but the image only ubuntu/python:3.12-24.04_stable is returning the error to have RUN or so.

Share Improve this question asked Mar 19 at 14:51 Hashimotto JoHashimotto Jo 132 bronze badges 2
  • From my understanding, this image consists only python but what I dont get is, the image is based on ubuntu, its wrapped up with python 3.12. So, how come is this available only for python if this is the case – Hashimotto Jo Commented Mar 19 at 14:53
  • Even if the apt command worked, it would only bloat the image. You should include the actual goal you are trying to achieve in the question since this is quite possibly an XY Problem. – BMitch Commented Mar 19 at 15:04
Add a comment  | 

1 Answer 1

Reset to default 0

This is equivalent to a distroless image:

This image is a chiselled Ubuntu rock that contains only the Python runtime and its standard libraries. It is production-ready and can also be used as a base if additional application dependencies are needed.

(Source: the Hub overview)

The image contains no shell, no apt package manager, or anything other than the python binary and its dependencies:

lrwxrwxrwx root/root         0 2025-02-05 17:44 bin -> usr/bin                                                                                                                                                     
drwxr-xr-x root/root         0 2025-02-05 17:44 etc/                                                                                                                                                               
-rw-r--r-- root/root      1853 2025-02-05 17:44 etc/ethertypes                                                                                                                                                     
-rw-r--r-- root/root      1875 2025-02-05 17:44 etc/inputrc                                                                                                                                                        
-rw-r--r-- root/root       114 2025-02-05 17:44 etc/localtime                                                                                                                                                      
-rw-r--r-- root/root     75113 2025-02-05 17:44 etc/mime.types                                                                                                                                                     
-rw-r--r-- root/root      3144 2025-02-05 17:44 etc/protocols                                                                                                                                                      
drwxr-xr-x root/root         0 2025-02-05 17:44 etc/python3.12/                                                                                                                                                    
-rw-r--r-- root/root       155 2025-02-05 17:44 etc/python3.12/sitecustomize.py                                                                                                                                    
-rw-r--r-- root/root       911 2025-02-05 17:44 etc/rpc                                                                                                                                                            
-rw-r--r-- root/root     12813 2025-02-05 17:44 etc/services                                                                                                                                                       
drwxr-xr-x root/root         0 2025-02-05 17:44 etc/ssl/                                                                                                                                                           
drwxr-xr-x root/root         0 2025-02-05 17:44 etc/ssl/certs/                                                                                                                                                     
-rw-r--r-- root/root    219342 2025-02-05 17:44 etc/ssl/certs/ca-certificates.crt                                                                                                                                  
-rw-r--r-- root/root     12324 2025-02-05 17:44 etc/ssl/openssl.cnf                                                                                                                                                
drwx------ root/root         0 2025-02-05 17:44 etc/ssl/private/
drwxr-xr-x root/root         0 2025-02-05 17:44 home/
lrwxrwxrwx root/root         0 2025-02-05 17:44 lib -> usr/lib
lrwxrwxrwx root/root         0 2025-02-05 17:44 lib64 -> usr/lib64
drwx------ root/root         0 2025-02-05 17:44 root/
drwxr-xr-x root/root         0 2025-02-05 17:44 run/ 
lrwxrwxrwx root/root         0 2025-02-05 17:44 sbin -> usr/sbin
drwxrwxrwt root/root         0 2025-02-05 17:44 tmp/ 
drwxr-xr-x root/root         0 2025-02-05 17:44 usr/ 
drwxr-xr-x root/root         0 2025-02-05 17:44 usr/bin/
-rwxr-xr-x root/root   8024216 2025-01-29 20:43 usr/bin/pebble
lrwxrwxrwx root/root         0 2025-02-05 17:44 usr/bin/python3 -> /usr/bin/python3.12
-rwxr-xr-x root/root   8023232 2025-02-05 17:44 usr/bin/python3.12
drwxr-xr-x root/root         0 2025-02-05 17:44 usr/lib/
drwxr-xr-x root/root         0 2025-02-05 17:44 usr/lib/python3.12/
-rw-r--r-- root/root      5218 2025-02-05 17:44 usr/lib/python3.12/__future__.py
...
发布评论

评论列表(0)

  1. 暂无评论