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

后端 未结 4 1525
感动是毒
感动是毒 2020-12-05 01:47

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 installe

4条回答
  •  温柔的废话
    2020-12-05 02:37

    The best practice is to not install glibc on Alpine Linux. It uses musl libc instead, a lightweight, fast, simple and standards-conform C library (i.e. everything that glibc is not).

    Instead of installing glibc on Alpine, build and/or package your dependent software packages and libraries for Alpine.

    • For python packages, the setup.py program will often recompile, rather than downloading a prebuild binary, when run on Alpine.

    • For java, use alpine openjdk instead of Oracle.

    • For faiss, and other numpy-dependent libraries in python (copied from https://gist.github.com/orenitamar/f29fb15db3b0d13178c1c4dd611adce2)

        FROM alpine:3.4
        RUN echo "http://dl-cdn.alpinelinux.org/alpine/latest-stable/main" > /etc/apk/repositories
        RUN echo "http://dl-cdn.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories
        RUN apk --no-cache --update-cache add gcc gfortran python python-dev py-pip build-base wget freetype-dev libpng-dev openblas-dev
        RUN ln -s /usr/include/locale.h /usr/include/xlocale.h
        RUN pip install numpy scipy pandas matplotlib
    

提交回复
热议问题