Can you install Ubuntu or Debian packages in Alpine?
You could actually install lightweight .deb
packages on Alpine using dpkg
. However, you'd need the .deb
files for all dependent packages, so this could work only for very simple cases.
The main issue for running Debian/Ubuntu binaries on Alpine is indeed glibc incompatiblity with musl libc. You could tackle it on several levels:
-
For light glibc compatibility, try installing
libc6-compat
. It is a thin wrapper around musl that provides some glibc interfaces and stubs. However, it is not likely to work for complex glibc applications. -
For full glibc compatibility, you could install glibc on your Alpine container, as suggested by @FederalReserve. This is actually a simple and common procedure. See for example: Dockerfile. glibc alone adds only a few extra MB to the Alpine image, which is relatively a lot considering Alpine base image is roughly 5MB on its own, but in absolute MB increase terms it should be definitely tolerable.
-
Attempt building the software natively on Alpine. In your case, Nginx with the
sub_filter
module enabled. However, for Nginx, I don't know for sure the amount of effort required (depending on Nginx build system and whether the module requires porting to Alpine Linux), so this is just a suggestion.
Related videos on Youtube
wesdork
Updated on September 18, 2022Comments
-
wesdork almost 2 years
I want to ask if it is possible to install Ubuntu or Debian packages in Alpine? I know Alpine uses musl while Debian uses glibc. Still I would like to know if it is possible without too much work. I am trying to port my server which runs on Ubuntu previously to Alpine but I realised that Nginx sub_filter is not available on Alpine's version of Nginx and I need that module.
-
Joe about 4 yearsShort answer is no.
-
Federal Reserve about 4 yearsYou can search for Alpine with glibc support, there are some custom Alpine versions that include glibc out there.
-
Philip Couling about 4 yearsI think honestly that you wouldn't want to. Alpine is designed to be very small and light weight. Sucking down a whole bunch of bloated dependencies for the sake of one server module would pretty much defeat the point of Alpine. Are you porting this for docker?
-
wesdork almost 4 yearsYes, I am trying to port what used to run on Ubuntu to Alpine so that I can keep the overall size small.
-
-
wesdork almost 4 yearsAlright, I will check out your suggestions to see which one works for me the best. Thank you!