docker-library / python

Docker Official Image packaging for Python

Home Page:https://www.python.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Latest Python 3.11 Alpine seems to have symlinks broken

akmalharith opened this issue · comments

In some packages that depend on python3.11-alpine, build totally breaks, ie: aws/aws-cli#8698

To reproduce this issue, build something on top of 3.11 Alpine:

FROM python:3.11-alpine AS python

# Install gcloud etc

RUN gcloud components install -q \
  kubectl \
  alpha \
  beta \
  gke-gcloud-auth-plugin

Error message:

 > [stage-2  5/17] RUN gcloud components install -q   kubectl   alpha   beta   gke-gcloud-auth-plugin:
0.265 Error relocating /usr/local/bin/../lib/libpython3.11.so.1.0: pwritev2: symbol not found
0.265 Error relocating /usr/local/bin/../lib/libpython3.11.so.1.0: preadv2: symbol not found
0.270 Error relocating /usr/local/bin/../lib/libpython3.11.so.1.0: pwritev2: symbol not found
0.271 Error relocating /usr/local/bin/../lib/libpython3.11.so.1.0: preadv2: symbol not found
0.273 Error relocating /usr/local/bin/../lib/libpython3.11.so.1.0: pwritev2: symbol not found
0.273 Error relocating /usr/local/bin/../lib/libpython3.11.so.1.0: preadv2: symbol not found

At the moment I have a workaround since our build pipelines are failing, to pin to Alpine 3.19

FROM python:3.11.9-alpine3.19

@LaurentGoderre so what are you suggesting as solution?

That kind of sounds like there's two versions of Python in the image (perhaps distro Python via apk and the Python provided by the python image?)

Can we get a simplified/minimal reproducer?

@tianon I think you have it already #927 (comment) or do you need something else?

# Install gcloud etc

That's where the problem likely lies. If python3 is installed in those layers, then it will very likely conflict in weird ways like the error given. Since you will have python3 (3.12, /usr/bin/python3) from apk packages and the source installed python3 (3.11, /usr/local/bin/python3) from the image.

(Pinning to Alpine 3.19 would mean the apk installed python is the same major Python version, 3.11, so might be less likely to conflict, but still not optimal)

I tried to get a reproducer by installing gcloud proved very difficult for this version of Python