【发布时间】:2016-10-15 14:07:26
【问题描述】:
是否有在 docker alpine linux 基础映像上设置 glibc 的最佳实践,并使用正确的路径,以便任何生成的进程都可以正确引用已安装的 libc 库的位置?
【问题讨论】:
-
Alpine 码头有一整页专门用于此...wiki.alpinelinux.org/wiki/Running_glibc_programs
是否有在 docker alpine linux 基础映像上设置 glibc 的最佳实践,并使用正确的路径,以便任何生成的进程都可以正确引用已安装的 libc 库的位置?
【问题讨论】:
到目前为止,每次安装 glibc 兼容性库都对我有用
apk add gcompat
https://pkgs.alpinelinux.org/package/edge/community/x86_64/gcompat
【讨论】:
我创建了一个 github repo Docker build for glibc for alpine,支持多架构,即 x86_64、aarch64 等。您可以通过一行命令从最新的 glibc 源构建任何 CPU 类型。它是从sgerrand's repo 派生的,我修改为支持多架构并将构建阶段和打包阶段合并为一条线。或者您可以从发布页面下载预构建的包。
【讨论】:
E: The repository 'http://mirrors.aliyun.com/ubuntu disco Release' does not have a Release file. E: The repository 'http://mirrors.aliyun.com/ubuntu disco-security Release' does not have a Release file. E: The repository 'http://mirrors.aliyun.com/ubuntu disco-updates Release' does not have a Release file. E: The repository 'http://mirrors.aliyun.com/ubuntu disco-backports Release' does not have a Release file. E: The repository 'http://mirrors.aliyun.com/ubuntu disco-proposed Release' does not have a Release file.
最佳做法是不在 Alpine Linux 上安装 glibc。它使用 musl libc 代替,这是一个轻量级、快速、简单且符合标准的 C 库(即 glibc 所不具备的一切)。
不要在 Alpine 上安装 glibc,而是为 Alpine 构建和/或打包您的依赖软件包和库。
对于 python 包,setup.py 程序在 Alpine 上运行时通常会重新编译,而不是下载预编译的二进制文件。
对于 java,使用 alpine openjdk 而不是 Oracle。
用于 faiss 和其他 python 中依赖于 numpy 的库(复制自 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
【讨论】:
是的,有,
我使用自定义构建的 glibc 在其上安装 JRE。
你可以找到它here
您可以使用 wget 或 curl 获取代码和 apk 来安装它们
更新的命令见下面的 cmets
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
对我来说效果很好
【讨论】: