Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a best practice on setting up glibc on docker alpine linux base image?

Is there a best practice on setting up glibc on docker alpine linux base image with correct paths so any spawned process can correctly reference the location of the installed libc libraries?

like image 494
kai Avatar asked Jun 14 '16 17:06

kai


People also ask

Does alpine use glibc?

If you want to run glibc programs in Alpine Linux, there are a few ways of doing so. You can install the gcompat compatibility layer, you can install glibc alongside musl (manually, as it isn't packaged), or you could do it the easy way and use either Flatpak (the easiest) or a chroot.

Should I use Alpine for Docker?

Alpine Linux won't always be the right OS choice for IT teams, but it's an option worth consideration when lightweight container images are the goal. When it comes to Docker, sometimes less is more -- a maxim that applies especially to the base OS images installed in each Docker image.

Is Alpine image good for production?

Alpine is a suitable Linux distribution for production because it only has the bare necessities that your application needs to run. In this tutorial, you'll optimize Docker images in a few simple steps, making them smaller, faster, and better suited for production.


2 Answers

Yes there is,

I've used a custom built glibc to install a JRE on it.

You can find it here

You can use wget or curl to get the code and apk to install them

UPDATED commands see comments below

apk --no-cache add ca-certificates wget wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk apk add glibc-2.28-r0.apk 

It worked perfectly for me

like image 166
carlomas Avatar answered Sep 22 '22 15:09

carlomas


Installing the glibc compatibility libraries has worked for me so far every time

apk add gcompat

https://pkgs.alpinelinux.org/package/edge/community/x86_64/gcompat

like image 21
secustor Avatar answered Sep 20 '22 15:09

secustor