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.

  • Short answer is no.
    – Joe
    Jun 18 '20 at 3:27
  • You can search for Alpine with glibc support, there are some custom Alpine versions that include glibc out there. Jun 18 '20 at 4:14
  • I 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? Jun 18 '20 at 6:47
  • Yes, I am trying to port what used to run on Ubuntu to Alpine so that I can keep the overall size small.
    – wesdork
    Jun 29 '20 at 0:09

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:

  1. 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.

  2. 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.

  3. 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.

  • Alright, I will check out your suggestions to see which one works for me the best. Thank you!
    – wesdork
    Jun 29 '20 at 0:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.