Can you install Ubuntu or Debian packages in Alpine?

5,913

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.

Share:
5,913

Related videos on Youtube

wesdork
Author by

wesdork

Updated on September 18, 2022

Comments

  • wesdork
    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
      Joe about 4 years
      Short answer is no.
    • Federal Reserve
      Federal Reserve about 4 years
      You can search for Alpine with glibc support, there are some custom Alpine versions that include glibc out there.
    • Philip Couling
      Philip Couling about 4 years
      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?
    • wesdork
      wesdork almost 4 years
      Yes, I am trying to port what used to run on Ubuntu to Alpine so that I can keep the overall size small.
  • wesdork
    wesdork almost 4 years
    Alright, I will check out your suggestions to see which one works for me the best. Thank you!