Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python Alpine images not working on armv7 #637

Closed
David-Lor opened this issue Aug 23, 2021 · 2 comments
Closed

Python Alpine images not working on armv7 #637

David-Lor opened this issue Aug 23, 2021 · 2 comments

Comments

@David-Lor
Copy link

Since the last few days, I've been experiencing that many (or maybe all) of the python alpine-based images do not work on armv7. Debian-based images seem to work fine, and the alpine-based images also work on amd64.

Here's some output where I try different tags and versions, of both Python and Alpine:

docker@pi:/home/opi$ docker run -it --rm python:3-alpine python                                                                                                                 [51/81]
Unable to find image 'python:3-alpine' locally                                                                                                                                        
3-alpine: Pulling from library/python         
4ee0caa23b36: Already exists   
fc2abd71660d: Already exists
6fb40097973e: Already exists                                            
d7296a96d484: Already exists                           
71f4aec5801c: Already exists                  
Digest: sha256:55fbe1ef2c62a1607ab702ac14111d9981d6b4f2a62351b75ffe34622f18dc3f
Status: Downloaded newer image for python:3-alpine         
Fatal Python error: init_interp_main: can't initialize time
Python runtime state: core initialized
PermissionError: [Errno 1] Operation not permitted
                                                                               
Current thread 0xb6fcb390 (most recent call first):        
<no Python frame>                        


               
docker@pi:/home/opi$ docker run -it --rm python:3-alpine3.13 python     
Unable to find image 'python:3-alpine3.13' locally     
3-alpine3.13: Pulling from library/python          
e160e00eb35d: Already exists
9ceaa6fd436a: Pull complete
e00d02274d62: Pull complete
8a2edf3b906b: Pull complete
09313ac9170b: Pull complete
Digest: sha256:379e453d41b5c25c6d5282ae30f16055ead6720f7f7cc8fd449fe5ded6705ed7
Status: Downloaded newer image for python:3-alpine3.13
Fatal Python error: init_interp_main: can't initialize time
Python runtime state: core initialized
PermissionError: [Errno 1] Operation not permitted

Current thread 0xb6fa6390 (most recent call first):
<no Python frame>



docker@pi:/home/opi$ docker run -it --rm python:3.8.11-alpine3.13 python
Unable to find image 'python:3.8.11-alpine3.13' locally
3.8.11-alpine3.13: Pulling from library/python
e160e00eb35d: Already exists
080a3da76c5a: Pull complete
293ff52afc61: Pull complete
99dd3fe08560: Pull complete
993c618bac52: Pull complete
Digest: sha256:5d8a7c8424ca2211dac2328026f82b8724333208db559f5d1e8c9cc2d5b0da7b
Status: Downloaded newer image for python:3.8.11-alpine3.13
Fatal Python error: pyinit_main: can't initialize time
Python runtime state: core initialized
PermissionError: [Errno 1] Operation not permitted

Current thread 0xb6f6b390 (most recent call first):
<no Python frame>



docker@pi:/home/opi$ docker run -it --rm python:3.7.11-alpine3.13 python                                                                                                         [2/81]
Unable to find image 'python:3.7.11-alpine3.13' locally
3.7.11-alpine3.13: Pulling from library/python
e160e00eb35d: Already exists
080a3da76c5a: Already exists
dac4002e3fd9: Pull complete
89b7785246be: Pull complete
f379a2aa6792: Pull complete
Digest: sha256:e069a92ba18adb18dc29baefb83b8574d0958464dc88abe58a2d4545542ec647
Status: Downloaded newer image for python:3.7.11-alpine3.13
Fatal Python error: _Py_InitializeMainInterpreter: can't initialize time
PermissionError: [Errno 1] Operation not permitted

Current thread 0xb6f49390 (most recent call first):



docker@pi:/home/opi$ docker run -it --rm python:3.6.14-alpine3.13 python
Unable to find image 'python:3.6.14-alpine3.13' locally
3.6.14-alpine3.13: Pulling from library/python
e160e00eb35d: Already exists
080a3da76c5a: Already exists
4a56a5cdf0e6: Pull complete
8d29f61fcd37: Pull complete
c35d713ebcc7: Pull complete
Digest: sha256:bb85ae8051cebf0b77897d190ba2424b7b805ce713ee55aeaa51e87be3efa245
Status: Downloaded newer image for python:3.6.14-alpine3.13
Fatal Python error: Py_Initialize: can't initialize time
PermissionError: [Errno 1] Operation not permitted

Current thread 0xb6f85390 (most recent call first):



# Debian-based images work fine:
docker@pi:/home/opi$ docker run -it --rm python:3.7.11-slim-buster python
Unable to find image 'python:3.7.11-slim-buster' locally
3.7.11-slim-buster: Pulling from library/python
13e3f03410ff: Already exists
f38a55d4e97c: Pull complete
4e7ff508b0a4: Pull complete
b9abd81c52b2: Pull complete
7aa4d4cbfceb: Pull complete
Digest: sha256:e3f5000fc331217f9c4e3c00a3fac14a1ce6126dc11901d88457f0cb5d8560e4
Status: Downloaded newer image for python:3.7.11-slim-buster
Python 3.7.11 (default, Aug 17 2021, 07:23:49)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

System info:

root@pi:/home/opi# screenfetch -n
 [email protected]
 OS: Debian 10 buster
 Kernel: armv7l Linux 5.10.34-sunxi
 Uptime: 65d 19m
 Packages: 479
 Shell: 7693
 CPU: ARMv7 rev 5 (v7l) @ 4x 1.368GHz [53.1°C]
 GPU: 
 RAM: 428MiB / 999MiB
@tianon
Copy link
Member

tianon commented Aug 23, 2021

@David-Lor
Copy link
Author

Indeed, got it working with the --security-opt=seccomp=default.json thing specified in that link. I guess it has nothing to do with the Python image compilation then, so I close this.

For anyone having the same problem, the following worked:

wget https://github.com/moby/moby/raw/768a1de1d0f12f17f0f34271dadaac8ff4877c82/profiles/seccomp/default.json
nano default.json
# Edit line 2 "defaultAction", change value "SCMP_ACT_ERRNO" with "SCMP_ACT_TRACE"
# I changed file name too to something more convenient

docker run -it --rm --security-opt=seccomp=default.json python:3-alpine python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants