5 ms·
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
by hn_acc_2 6y 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/ https://pythonspeed.com/articles/alpine-docker-python/
- chrisjc 6y agoOut of curiosity, which container have you settled on instead? debian:buster-slim?
- hn_acc_2 6y agoI 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)
- DiabloD3 6y agoSo just use the glibc compat layer, or also install glibc. https://wiki.alpinelinux.org/wiki/Running_glibc_programs https://wiki.alpinelinux.org/wiki/Running_glibc_programs
- nenolod 6y agothis page really should be updated, at this point all you basically have to do is `apk add gcompat`.
- hn_acc_2 6y agoIf 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
- ossusermivami 6y agoI 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_enterprise_linux/8/html-single/building_running_and_managing_containers/index?extIdCarryOver=true&sc_cid=701f2000000tyBjAAI#using_minimal_red_hat_base_images 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.
- turminal 6y agoI 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.
- saagarjha 6y agoThey do work, though.
- hn_acc_2 6y agoUnfortunately 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
- nenolod 6y agoThe 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.