Hacker News new | ask | show | jobs
by hn_acc_2 1986 days ago
Another "I want to love Alpine but can't" user here.

Their use of musl libc makes it a very poor choice for running python in a container, because it forces a lot of manual rebuilding since the PyPi wheels don't work on Alpine, among other issues [1]

[1] https://pythonspeed.com/articles/alpine-docker-python/

3 comments

I believe Alpine isn't meant to be used with pip, npm, and the like. Instead you are encouraged to create alpine packages out of your dependecies and submit them upstream. Writing a new package is completely trivial in Alpine, that's one of the things that made me switch to it.
Unfortunately the Python package ecosystem is enough of a headache.

Now we add additional complication "OK, these pip package authors have upstreamed Alpine packages, and these other ones are only on PyPi".

Maybe this approach would work if you can keep your Python dependencies to a small list of well-maintained packages

The good news is that there is work in progress to untangle the mess with PyPI wheels and musl. But it is easy enough to just not use wheels.
They do work, though.
So just use the glibc compat layer, or also install glibc.

https://wiki.alpinelinux.org/wiki/Running_glibc_programs

If you ask me, installing glibc / compat layers defeats the purpose of using Alpine, especially since Alpine ultimately only saved me ~50 MB on image size versus a similarly configured debian:slim-buster image
I use UBI minimal docker image from redhat which is based on RHEL but free from license :

https://access.redhat.com/documentation/en-us/red_hat_enterp...

Pretty small and has most of the things i need :

Minimal images are about 92M on disk and 32M compressed. This makes it less than half the size of the standard images.

this page really should be updated, at this point all you basically have to do is `apk add gcompat`.
Out of curiosity, which container have you settled on instead? debian:buster-slim?
I did settle on Debian, using i.e. python:3.9-slim-buster (though you can just as easily start from debian and install your python version)