• 使用Docker运行java项目需要注意的glibc依赖库问题


    docker官方推荐java是基于glibc库,而alpine默认只提供mini libc,故需要安装glibc库

    官方wiki: https://wiki.alpinelinux.org/wiki/Running_glibc_programs
    安装:https://github.com/sgerrand/alpine-pkg-glibc

    如下这些是官方提供的安装教程

    Installing
    
    The current installation method for these packages is to pull them in using wget or curl and install the local file with apk:
    
    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.34-r0/glibc-2.34-r0.apk
    apk add glibc-2.34-r0.apk
    
    Please Note
    
    ⚠️ The URL of the public signing key has changed! ⚠️
    
    Any previous reference to https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub should be updated with immediate effect to https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub.
    Locales
    
    You will need to generate your locale if you would like to use a specific one for your glibc application. You can do this by installing the glibc-i18n package and generating a locale using the localedef binary. An example for en_US.UTF-8 would be:
    
    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-bin-2.34-r0.apk
    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-i18n-2.34-r0.apk
    apk add glibc-bin-2.34-r0.apk glibc-i18n-2.34-r0.apk
    /usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8
    

    结合自己自定义的docker镜像的Dockerfile文件,需要修改该文件:
    原先Dockerfile文件内容如下:

    FROM alpine:latest
    MAINTAINER sandu <1103324414@qq.com>
    COPY localtime /etc/localtime
    COPY timezone /etc/timezone
    RUN echo "https://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositories
    RUN echo "https://mirrors.aliyun.com/alpine/latest-stable/community/" >> /etc/apk/repositories
    RUN ["apk","update"]
    RUN ["apk","add","curl"]
    RUN ["apk","add","openjdk8-jre"]
    

    单独运行alpine镜像,把这俩文件cp进去,然后安装,会发现有如下报错信息

    # docker pull alpine:latest
    # docker run -it -d --name alpine alpine:latest
    # docker cp glibc-bin-2.34-r0.apk alpine:/tmp
    # docker cp glibc-i18n-2.34-r0.apk alpine:/tmp
    
    # docker exec -it alpine /bin/sh
    /# cd /tmp
    /tmp # apk add glibc-bin-2.34-r0.apk 
    ERROR: glibc-bin-2.34-r0.apk: UNTRUSTED signature
    

    签名问题不太好处理,看来这个办法行不通了。

    采用直接在线上下载安装的方式:

    # docker pull alpine:latest
    # docker run -it --name alpine alpine:latest
    /# cd /tmp
    /tmp # wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
    /tmp # wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-2.34-r0.apk
    /tmp # wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-bin-2.34-r0.apk
    /tmp # wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-i18n-2.34-r0.apk
    /tmp # apk add glibc-2.34-r0.apk glibc-bin-2.34-r0.apk glibc-i18n-2.34-r0.apk
    /tmp # /usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8
    [error] character map file `UTF-8' not found: No such file or directory
    [error] default character map file `ANSI_X3.4-1968' not found: No such file or directory
    

    在这里又报字符串找不到的问题,那再换取其他办法。

    第一种办法:直接使用含有glibc的alpine镜像,然后替换Dockerfile文件中的FROM alpine:latest

    # 任选其一即可
    docker pull docker.io/jeanblanchard/alpine-glibc:latest
    docker pull jlesage/baseimage:alpine-3.7-glibc
    

    第二种办法:先编译安装一个含有glibc的alpine镜像,Dockerfile文件如下

    FROM alpine:3.10
    
    RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" && 
        ALPINE_GLIBC_PACKAGE_VERSION="2.27-r0" && 
        ALPINE_GLIBC_BASE_PACKAGE_FILENAME="glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && 
        ALPINE_GLIBC_BIN_PACKAGE_FILENAME="glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && 
        ALPINE_GLIBC_I18N_PACKAGE_FILENAME="glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && 
        apk add --no-cache --virtual=.build-dependencies wget ca-certificates && 
        echo 
            "-----BEGIN PUBLIC KEY-----
            MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApZ2u1KJKUu/fW4A25y9m
            y70AGEa/J3Wi5ibNVGNn1gT1r0VfgeWd0pUybS4UmcHdiNzxJPgoWQhV2SSW1JYu
            tOqKZF5QSN6X937PTUpNBjUvLtTQ1ve1fp39uf/lEXPpFpOPL88LKnDBgbh7wkCp
            m2KzLVGChf83MS0ShL6G9EQIAUxLm99VpgRjwqTQ/KfzGtpke1wqws4au0Ab4qPY
            KXvMLSPLUp7cfulWvhmZSegr5AdhNw5KNizPqCJT8ZrGvgHypXyiFvvAH5YRtSsc
            Zvo9GI2e2MaZyo9/lvb+LbLEJZKEQckqRj4P26gmASrZEPStwc+yqy1ShHLA0j6m
            1QIDAQAB
            -----END PUBLIC KEY-----" | sed 's/   */
    /g' > "/etc/apk/keys/sgerrand.rsa.pub" && 
        wget 
            "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" 
            "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" 
            "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && 
        apk add --no-cache 
            "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" 
            "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" 
            "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && 
        
        rm "/etc/apk/keys/sgerrand.rsa.pub" && 
        /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true && 
        echo "export LANG=$LANG" > /etc/profile.d/locale.sh && 
        
        apk del glibc-i18n && 
        
        rm "/root/.wget-hsts" && 
        apk del .build-dependencies && 
        rm 
            "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" 
            "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" 
            "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME"
    
    RUN  apk add -U tzdata curl 
    && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime  
    && apk del tzdata 
    && rm -rf /var/cache/apk/*
    
    # docker build -t alpine_glibc:3.10 .
    Sending build context to Docker daemon  4.096kB
    Step 1/3 : FROM alpine:3.10
    3.10: Pulling from library/alpine
    396c31837116: Pull complete 
    Digest: sha256:451eee8bedcb2f029756dc3e9d73bab0e7943c1ac55cff3a4861c52a0fdd3e98
    Status: Downloaded newer image for alpine:3.10
     ---> e7b300aee9f9
    Step 2/3 : RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" &&     ALPINE_GLIBC_PACKAGE_VERSION="2.27-r0" &&     ALPINE_GLIBC_BASE_PACKAGE_FILENAME="glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk" &&     ALPINE_GLIBC_BIN_PACKAGE_FILENAME="glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk" &&     ALPINE_GLIBC_I18N_PACKAGE_FILENAME="glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk" &&     apk add --no-cache --virtual=.build-dependencies wget ca-certificates &&     echo         "-----BEGIN PUBLIC KEY-----        MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApZ2u1KJKUu/fW4A25y9m        y70AGEa/J3Wi5ibNVGNn1gT1r0VfgeWd0pUybS4UmcHdiNzxJPgoWQhV2SSW1JYu        tOqKZF5QSN6X937PTUpNBjUvLtTQ1ve1fp39uf/lEXPpFpOPL88LKnDBgbh7wkCp        m2KzLVGChf83MS0ShL6G9EQIAUxLm99VpgRjwqTQ/KfzGtpke1wqws4au0Ab4qPY        KXvMLSPLUp7cfulWvhmZSegr5AdhNw5KNizPqCJT8ZrGvgHypXyiFvvAH5YRtSsc        Zvo9GI2e2MaZyo9/lvb+LbLEJZKEQckqRj4P26gmASrZEPStwc+yqy1ShHLA0j6m        1QIDAQAB        -----END PUBLIC KEY-----" | sed 's/   */
    /g' > "/etc/apk/keys/sgerrand.rsa.pub" &&     wget         "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME"         "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME"         "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" &&     apk add --no-cache         "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME"         "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME"         "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" &&         rm "/etc/apk/keys/sgerrand.rsa.pub" &&     /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true &&     echo "export LANG=$LANG" > /etc/profile.d/locale.sh &&         apk del glibc-i18n &&         rm "/root/.wget-hsts" &&     apk del .build-dependencies &&     rm         "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME"         "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME"         "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME"
     ---> Running in b07838b88aaa
    fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
    fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
    (1/3) Installing wget (1.20.3-r0)
    (2/3) Installing ca-certificates (20191127-r2)
    (3/3) Installing .build-dependencies (20210831.023148)
    Executing busybox-1.30.1-r5.trigger
    Executing ca-certificates-20191127-r2.trigger
    OK: 7 MiB in 17 packages
    --2021-08-31 02:32:03--  https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.27-r0/glibc-2.27-r0.apk
    Resolving github.com... 20.205.243.166
    Connecting to github.com|20.205.243.166|:443... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: https://github-releases.githubusercontent.com/33333969/b4285ae2-0bdc-11e8-9c3e-9042c4df4553?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210831%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210831T023204Z&X-Amz-Expires=300&X-Amz-Signature=7e8d3e5927d0116f6171df5ccf77bb1c9c7a6976552df5641c0352b2d8ea0fd7&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=33333969&response-content-disposition=attachment%3B%20filename%3Dglibc-2.27-r0.apk&response-content-type=application%2Fvnd.android.package-archive [following]
    --2021-08-31 02:32:04--  https://github-releases.githubusercontent.com/33333969/b4285ae2-0bdc-11e8-9c3e-9042c4df4553?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210831%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210831T023204Z&X-Amz-Expires=300&X-Amz-Signature=7e8d3e5927d0116f6171df5ccf77bb1c9c7a6976552df5641c0352b2d8ea0fd7&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=33333969&response-content-disposition=attachment%3B%20filename%3Dglibc-2.27-r0.apk&response-content-type=application%2Fvnd.android.package-archive
    Resolving github-releases.githubusercontent.com... 185.199.110.154, 185.199.109.154, 185.199.108.154, ...
    Connecting to github-releases.githubusercontent.com|185.199.110.154|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 2343401 (2.2M) [application/vnd.android.package-archive]
    Saving to: 'glibc-2.27-r0.apk'
    
         0K .......... .......... .......... .......... ..........  2%  118K 19s
        50K .......... .......... .......... .......... ..........  4% 58.8K 28s
       100K .......... .......... .......... .......... ..........  6% 31.9K 40s
       150K .......... .......... .......... .......... ..........  8% 19.8K 56s
       200K .......... .......... .......... .......... .......... 10% 7.68K 97s
       250K .......... .......... .......... .......... .......... 13% 20.6K 95s
       300K .......... .......... .......... .......... .......... 15% 35.2K 87s
       350K .......... .......... .......... .......... .......... 17% 25.6K 83s
       400K .......... .......... .......... .......... .......... 19% 29.4K 79s
       450K .......... .......... .......... .......... .......... 21% 25.0K 76s
       500K .......... .......... .......... .......... .......... 24% 25.1K 74s
       550K .......... .......... .......... .......... .......... 26% 30.9K 70s
       600K .......... .......... .......... .......... .......... 28% 24.9K 68s
       650K .......... .......... .......... .......... .......... 30% 12.4K 70s
       700K .......... .......... .......... .......... .......... 32% 33.2K 67s
       750K .......... .......... .......... .......... .......... 34% 20.7K 65s
       800K .......... .......... .......... .......... .......... 37% 19.3K 64s
       850K .......... .......... .......... .......... .......... 39% 34.8K 60s
       900K .......... .......... .......... .......... .......... 41% 37.7K 57s
       950K .......... .......... .......... .......... .......... 43% 55.1K 53s
      1000K .......... .......... .......... .......... .......... 45% 38.6K 50s
      1050K .......... .......... .......... .......... .......... 48% 45.9K 47s
      1100K .......... .......... .......... .......... .......... 50% 33.9K 45s
      1150K .......... .......... .......... .......... .......... 52% 16.5K 44s
      1200K .......... .......... .......... .......... .......... 54% 17.9K 42s
      1250K .......... .......... .......... .......... .......... 56% 16.9K 41s
      1300K .......... .......... .......... .......... .......... 58% 44.5K 38s
      1350K .......... .......... .......... .......... .......... 61% 21.7K 36s
      1400K .......... .......... .......... .......... .......... 63% 30.5K 34s
      1450K .......... .......... .......... .......... .......... 65% 26.7K 32s
      1500K .......... .......... .......... .......... .......... 67% 17.2K 30s
      1550K .......... .......... .......... .......... .......... 69% 18.1K 29s
      1600K .......... .......... .......... .......... .......... 72% 20.8K 27s
      1650K .......... .......... .......... .......... .......... 74% 37.0K 24s
      1700K .......... .......... .......... .......... .......... 76% 24.9K 22s
      1750K .......... .......... .......... .......... .......... 78% 27.5K 20s
      1800K .......... .......... .......... .......... .......... 80% 24.5K 18s
      1850K .......... .......... .......... .......... .......... 83% 30.7K 16s
      1900K .......... .......... .......... .......... .......... 85% 31.7K 14s
      1950K .......... .......... .......... .......... .......... 87% 42.3K 12s
      2000K .......... .......... .......... .......... .......... 89% 16.3K 10s
      2050K .......... .......... .......... .......... .......... 91% 21.1K 8s
      2100K .......... .......... .......... .......... .......... 93% 12.1K 6s
      2150K .......... .......... .......... .......... .......... 96% 31.8K 4s
      2200K .......... .......... .......... .......... .......... 98% 22.2K 2s
      2250K .......... .......... .......... ........             100% 20.1K=96s
    
    2021-08-31 02:33:42 (23.9 KB/s) - 'glibc-2.27-r0.apk' saved [2343401/2343401]
    
    --2021-08-31 02:33:42--  https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.27-r0/glibc-bin-2.27-r0.apk
    Connecting to github.com|20.205.243.166|:443... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: https://github-releases.githubusercontent.com/33333969/b45ff75e-0bdc-11e8-8000-22163a9a240a?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210831%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210831T023342Z&X-Amz-Expires=300&X-Amz-Signature=f33ac1af112792efe5e3388dc9b963d27d9bde8e78b83ff8945808d530ecaae0&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=33333969&response-content-disposition=attachment%3B%20filename%3Dglibc-bin-2.27-r0.apk&response-content-type=application%2Fvnd.android.package-archive [following]
    --2021-08-31 02:33:42--  https://github-releases.githubusercontent.com/33333969/b45ff75e-0bdc-11e8-8000-22163a9a240a?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210831%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210831T023342Z&X-Amz-Expires=300&X-Amz-Signature=f33ac1af112792efe5e3388dc9b963d27d9bde8e78b83ff8945808d530ecaae0&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=33333969&response-content-disposition=attachment%3B%20filename%3Dglibc-bin-2.27-r0.apk&response-content-type=application%2Fvnd.android.package-archive
    Connecting to github-releases.githubusercontent.com|185.199.110.154|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 930656 (909K) [application/vnd.android.package-archive]
    Saving to: 'glibc-bin-2.27-r0.apk'
    
         0K .......... .......... .......... .......... ..........  5%  182K 5s
        50K .......... .......... .......... .......... .......... 11% 50.5K 10s
       100K .......... .......... .......... .......... .......... 16% 9.18K 34s
       150K .......... .......... .......... .......... .......... 22% 7.37K 48s
       200K .......... .......... .......... .......... .......... 27% 19.5K 42s
       250K .......... .......... .......... .......... .......... 33% 15.9K 39s
       300K .......... .......... .......... .......... .......... 38% 8.58K 40s
       350K .......... .......... .......... .......... .......... 44% 18.5K 35s
       400K .......... .......... .......... .......... .......... 49% 10.6K 33s
       450K .......... .......... .......... .......... .......... 55% 12.9K 30s
       500K .......... .......... .......... .......... .......... 60% 9.43K 27s
       550K .......... .......... .......... .......... .......... 66% 12.3K 24s
       600K .......... .......... .......... .......... .......... 71% 19.7K 19s
       650K .......... .......... .......... .......... .......... 77% 47.8K 15s
       700K .......... .......... .......... .......... .......... 82% 19.0K 11s
       750K .......... .......... .......... .......... .......... 88% 19.6K 7s
       800K .......... .......... .......... .......... .......... 93% 12.4K 4s
       850K .......... .......... .......... .......... .......... 99% 14.5K 1s
       900K ........                                              100% 22.2M=62s
    
    2021-08-31 02:34:45 (14.7 KB/s) - 'glibc-bin-2.27-r0.apk' saved [930656/930656]
    
    --2021-08-31 02:34:45--  https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.27-r0/glibc-i18n-2.27-r0.apk
    Connecting to github.com|20.205.243.166|:443... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: https://github-releases.githubusercontent.com/33333969/b426bf16-0bdc-11e8-91fb-2e6ff33e0079?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210831%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210831T023445Z&X-Amz-Expires=300&X-Amz-Signature=56592773198e83c48d09f558ac19135f6ada3daf651d194935cbe694fce464d5&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=33333969&response-content-disposition=attachment%3B%20filename%3Dglibc-i18n-2.27-r0.apk&response-content-type=application%2Fvnd.android.package-archive [following]
    --2021-08-31 02:34:46--  https://github-releases.githubusercontent.com/33333969/b426bf16-0bdc-11e8-91fb-2e6ff33e0079?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210831%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210831T023445Z&X-Amz-Expires=300&X-Amz-Signature=56592773198e83c48d09f558ac19135f6ada3daf651d194935cbe694fce464d5&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=33333969&response-content-disposition=attachment%3B%20filename%3Dglibc-i18n-2.27-r0.apk&response-content-type=application%2Fvnd.android.package-archive
    Connecting to github-releases.githubusercontent.com|185.199.110.154|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 4550208 (4.3M) [application/vnd.android.package-archive]
    Saving to: 'glibc-i18n-2.27-r0.apk'
    
         0K .......... .......... .......... .......... ..........  1%  120K 37s
        50K .......... .......... .......... .......... ..........  2% 87.8K 43s
       100K .......... .......... .......... .......... ..........  3% 9.65K 2m57s
       150K .......... .......... .......... .......... ..........  4% 10.4K 3m53s
       200K .......... .......... .......... .......... ..........  5% 12.3K 4m12s
       250K .......... .......... .......... .......... ..........  6% 10.9K 4m31s
       300K .......... .......... .......... .......... ..........  7% 19.2K 4m20s
       350K .......... .......... .......... .......... ..........  9% 29.4K 4m2s
       400K .......... .......... .......... .......... .......... 10% 11.7K 4m10s
       450K .......... .......... .......... .......... .......... 11% 7.61K 4m34s
       500K .......... .......... .......... .......... .......... 12% 8.57K 4m47s
       550K .......... .......... .......... .......... .......... 13% 9.58K 4m54s
       600K .......... .......... .......... .......... .......... 14% 6.33K 5m13s
       650K .......... .......... .......... .......... .......... 15% 12.1K 5m9s
       700K .......... .......... .......... .......... .......... 16% 11.3K 5m7s
       750K .......... .......... .......... .......... .......... 18% 12.8K 5m1s
       800K .......... .......... .......... .......... .......... 19% 11.6K 4m58s
       850K .......... .......... .......... .......... .......... 20% 18.2K 4m48s
       900K .......... .......... .......... .......... .......... 21% 2.78K 5m36s
       950K .......... .......... .......... .......... .......... 22% 19.1K 5m23s
      1000K .......... .......... .......... .......... .......... 23% 14.6K 5m14s
      1050K .......... .......... .......... .......... .......... 24% 13.0K 5m7s
      1100K .......... .......... .......... .......... .......... 25% 19.6K 4m57s
      1150K .......... .......... .......... .......... .......... 27% 28.1K 4m45s
      1200K .......... .......... .......... .......... .......... 28% 14.4K 4m38s
      1250K .......... .......... .......... .......... .......... 29% 7.23K 4m40s
      1300K .......... .......... .......... .......... .......... 30% 8.57K 4m39s
      1350K .......... .......... .......... .......... .......... 31% 19.9K 4m30s
      1400K .......... .......... .......... .......... .......... 32% 12.3K 4m25s
      1450K .......... .......... .......... .......... .......... 33% 21.0K 4m16s
      1500K .......... .......... .......... .......... .......... 34% 8.34K 4m15s
      1550K .......... .......... .......... .......... .......... 36% 4.80K 4m21s
      1600K .......... .......... .......... .......... .......... 37% 9.07K 4m18s
      1650K .......... .......... .......... .......... .......... 38% 10.9K 4m14s
      1700K .......... .......... .......... .......... .......... 39% 9.41K 4m10s
      1750K .......... .......... .......... .......... .......... 40% 8.07K 4m8s
      1800K .......... .......... .......... .......... .......... 41% 9.50K 4m4s
      1850K .......... .......... .......... .......... .......... 42% 8.13K 4m1s
      1900K .......... .......... .......... .......... .......... 43% 15.4K 3m54s
      1950K .......... .......... .......... .......... .......... 45% 11.0K 3m50s
      2000K .......... .......... .......... .......... .......... 46% 11.2K 3m45s
      2050K .......... .......... .......... .......... .......... 47% 10.8K 3m40s
      2100K .......... .......... .......... .......... .......... 48% 12.7K 3m34s
      2150K .......... .......... .......... .......... .......... 49% 10.2K 3m30s
      2200K .......... .......... .......... .......... .......... 50% 8.36K 3m26s
      2250K .......... .......... .......... .......... .......... 51% 8.00K 3m23s
      2300K .......... .......... .......... .......... .......... 52% 8.57K 3m19s
      2350K .......... .......... .......... .......... .......... 54% 9.56K 3m15s
      2400K .......... .......... .......... .......... .......... 55% 11.9K 3m10s
      2450K .......... .......... .......... .......... .......... 56% 12.7K 3m4s
      2500K .......... .......... .......... .......... .......... 57% 14.3K 2m59s
      2550K .......... .......... .......... .......... .......... 58% 7.52K 2m55s
      2600K .......... .......... .......... .......... .......... 59% 9.56K 2m51s
      2650K .......... .......... .......... .......... .......... 60% 5.34K 2m49s
      2700K .......... .......... .......... .......... .......... 61% 11.4K 2m44s
      2750K .......... .......... .......... .......... .......... 63% 9.44K 2m39s
      2800K .......... .......... .......... .......... .......... 64% 18.7K 2m33s
      2850K .......... .......... .......... .......... .......... 65% 18.0K 2m27s
      2900K .......... .......... .......... .......... .......... 66% 20.7K 2m21s
      2950K .......... .......... .......... .......... .......... 67% 13.8K 2m16s
      3000K .......... .......... .......... .......... .......... 68% 10.1K 2m12s
      3050K .......... .......... .......... .......... .......... 69% 16.1K 2m6s
      3100K .......... .......... .......... .......... .......... 70% 12.0K 2m1s
      3150K .......... .......... .......... .......... .......... 72% 8.01K 1m57s
      3200K .......... .......... .......... .......... .......... 73% 15.7K 1m52s
      3250K .......... .......... .......... .......... .......... 74% 17.5K 1m47s
      3300K .......... .......... .......... .......... .......... 75% 7.46K 1m43s
      3350K .......... .......... .......... .......... .......... 76% 14.8K 98s
      3400K .......... .......... .......... .......... .......... 77% 6.28K 94s
      3450K .......... .......... .......... .......... .......... 78% 7.98K 89s
      3500K .......... .......... .......... .......... .......... 79% 17.6K 84s
      3550K .......... .......... .......... .......... .......... 81% 13.1K 79s
      3600K .......... .......... .......... .......... .......... 82% 7.81K 75s
      3650K .......... .......... .......... .......... .......... 83% 12.3K 70s
      3700K .......... .......... .......... .......... .......... 84% 8.34K 66s
      3750K .......... .......... .......... .......... .......... 85% 9.68K 61s
      3800K .......... .......... .......... .......... .......... 86% 7.66K 57s
      3850K .......... .......... .......... .......... .......... 87% 6.35K 52s
      3900K .......... .......... .......... .......... .......... 88% 11.8K 47s
      3950K .......... .......... .......... .......... .......... 90% 16.5K 42s
      4000K .......... .......... .......... .......... .......... 91% 13.9K 37s
      4050K .......... .......... .......... .......... .......... 92% 8.86K 33s
      4100K .......... .......... .......... .......... .......... 93% 6.78K 28s
      4150K .......... .......... .......... .......... .......... 94% 15.0K 23s
      4200K .......... .......... .......... .......... .......... 95% 24.3K 18s
      4250K .......... .......... .......... .......... .......... 96% 8.65K 14s
      4300K .......... .......... .......... .......... .......... 97% 12.5K 9s
      4350K .......... .......... .......... .......... .......... 99% 24.2K 4s
      4400K .......... .......... .......... .......... ...       100% 10.5K=7m0s
    
    2021-08-31 02:41:46 (10.6 KB/s) - 'glibc-i18n-2.27-r0.apk' saved [4550208/4550208]
    
    FINISHED --2021-08-31 02:41:46--
    Total wall clock time: 9m 43s
    Downloaded: 3 files, 7.5M in 9m 38s (13.2 KB/s)
    fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
    fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
    (1/4) Installing glibc (2.27-r0)
    (2/4) Installing libgcc (8.3.0-r0)
    (3/4) Installing glibc-bin (2.27-r0)
    (4/4) Installing glibc-i18n (2.27-r0)
    Executing glibc-bin-2.27-r0.trigger
    OK: 27 MiB in 21 packages
    [warning] No definition for LC_PAPER category found
    [warning] No definition for LC_NAME category found
    [warning] No definition for LC_ADDRESS category found
    [warning] No definition for LC_TELEPHONE category found
    [warning] No definition for LC_MEASUREMENT category found
    [warning] No definition for LC_IDENTIFICATION category found
    WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.10/main: No such file or directory
    WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.10/community: No such file or directory
    (1/1) Purging glibc-i18n (2.27-r0)
    OK: 14 MiB in 20 packages
    (1/3) Purging .build-dependencies (20210831.023148)
    (2/3) Purging wget (1.20.3-r0)
    (3/3) Purging ca-certificates (20191127-r2)
    WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.10/main: No such file or directory
    WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.10/community: No such file or directory
    Executing ca-certificates-20191127-r2.post-deinstall
    Executing busybox-1.30.1-r5.trigger
    OK: 12 MiB in 17 packages
    Removing intermediate container b07838b88aaa
     ---> dc5967c2ce07
    Step 3/3 : RUN  apk add -U tzdata curl && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && apk del tzdata && rm -rf /var/cache/apk/*
     ---> Running in 36ccc65b3eb7
    fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
    fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
    (1/5) Installing ca-certificates (20191127-r2)
    (2/5) Installing nghttp2-libs (1.39.2-r1)
    (3/5) Installing libcurl (7.66.0-r4)
    (4/5) Installing curl (7.66.0-r4)
    (5/5) Installing tzdata (2021a-r0)
    Executing busybox-1.30.1-r5.trigger
    Executing ca-certificates-20191127-r2.trigger
    Executing glibc-bin-2.27-r0.trigger
    OK: 17 MiB in 22 packages
    (1/1) Purging tzdata (2021a-r0)
    Executing busybox-1.30.1-r5.trigger
    OK: 14 MiB in 21 packages
    Removing intermediate container 36ccc65b3eb7
     ---> 19233ea6669d
    Successfully built 19233ea6669d
    Successfully tagged alpine_glibc:3.10
    

    通过如上信息可以看到这样是可以编译成功的,但是有俩问题,一是需要从国外服务器拉取文件,这个速度比较慢,可以换成国内的阿里云下载地址,二是使用的apline和gilbc都不是最新版本的,可以更换成最新版本的再编译一个

    FROM alpine:3.14.2
    
    #RUN echo "https://mirrors.aliyun.com/alpine/v3.10/main/" > /etc/apk/repositories
    #RUN echo "https://mirrors.aliyun.com/alpine/v3.10/community/" >> /etc/apk/repositories
    
    RUN echo "https://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositories
    RUN echo "https://mirrors.aliyun.com/alpine/latest-stable/community/" >> /etc/apk/repositories
    
    RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" && 
        ALPINE_GLIBC_PACKAGE_VERSION="2.34-r0" && 
        ALPINE_GLIBC_BASE_PACKAGE_FILENAME="glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && 
        ALPINE_GLIBC_BIN_PACKAGE_FILENAME="glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && 
        ALPINE_GLIBC_I18N_PACKAGE_FILENAME="glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && 
        apk add --no-cache --virtual=.build-dependencies wget ca-certificates && 
        echo 
            "-----BEGIN PUBLIC KEY-----
            MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApZ2u1KJKUu/fW4A25y9m
            y70AGEa/J3Wi5ibNVGNn1gT1r0VfgeWd0pUybS4UmcHdiNzxJPgoWQhV2SSW1JYu
            tOqKZF5QSN6X937PTUpNBjUvLtTQ1ve1fp39uf/lEXPpFpOPL88LKnDBgbh7wkCp
            m2KzLVGChf83MS0ShL6G9EQIAUxLm99VpgRjwqTQ/KfzGtpke1wqws4au0Ab4qPY
            KXvMLSPLUp7cfulWvhmZSegr5AdhNw5KNizPqCJT8ZrGvgHypXyiFvvAH5YRtSsc
            Zvo9GI2e2MaZyo9/lvb+LbLEJZKEQckqRj4P26gmASrZEPStwc+yqy1ShHLA0j6m
            1QIDAQAB
            -----END PUBLIC KEY-----" | sed 's/   */
    /g' > "/etc/apk/keys/sgerrand.rsa.pub" && 
        wget 
            "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" 
            "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" 
            "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && 
        apk add --no-cache 
            "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" 
            "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" 
            "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && 
        
        rm "/etc/apk/keys/sgerrand.rsa.pub" && 
        /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true && 
        echo "export LANG=$LANG" > /etc/profile.d/locale.sh && 
        
        apk del glibc-i18n && 
        
        rm "/root/.wget-hsts" && 
        apk del .build-dependencies && 
        rm 
            "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" 
            "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" 
            "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME"
    
    RUN  apk add -U tzdata curl 
    && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime  
    && apk del tzdata 
    && rm -rf /var/cache/apk/*
    
    # docker build -t alpine_glibc:3.14.2 -f Dockerfile_new .
    Sending build context to Docker daemon   7.68kB
    Step 1/5 : FROM alpine:3.14.2
    3.14.2: Pulling from library/alpine
    a0d0a0d46f8b: Pull complete 
    Digest: sha256:e1c082e3d3c45cccac829840a25941e679c25d438cc8412c2fa221cf1a824e6a
    Status: Downloaded newer image for alpine:3.14.2
     ---> 14119a10abf4
    Step 2/5 : RUN echo "https://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositories
     ---> Running in c78554d2536d
    Removing intermediate container c78554d2536d
     ---> 0b452cf6c841
    Step 3/5 : RUN echo "https://mirrors.aliyun.com/alpine/latest-stable/community/" >> /etc/apk/repositories
     ---> Running in 83aedfb724f2
    Removing intermediate container 83aedfb724f2
     ---> 43528e8c49fc
    Step 4/5 : RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" &&     ALPINE_GLIBC_PACKAGE_VERSION="2.34-r0" &&     ALPINE_GLIBC_BASE_PACKAGE_FILENAME="glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk" &&     ALPINE_GLIBC_BIN_PACKAGE_FILENAME="glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk" &&     ALPINE_GLIBC_I18N_PACKAGE_FILENAME="glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk" &&     apk add --no-cache --virtual=.build-dependencies wget ca-certificates &&     echo         "-----BEGIN PUBLIC KEY-----        MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApZ2u1KJKUu/fW4A25y9m        y70AGEa/J3Wi5ibNVGNn1gT1r0VfgeWd0pUybS4UmcHdiNzxJPgoWQhV2SSW1JYu        tOqKZF5QSN6X937PTUpNBjUvLtTQ1ve1fp39uf/lEXPpFpOPL88LKnDBgbh7wkCp        m2KzLVGChf83MS0ShL6G9EQIAUxLm99VpgRjwqTQ/KfzGtpke1wqws4au0Ab4qPY        KXvMLSPLUp7cfulWvhmZSegr5AdhNw5KNizPqCJT8ZrGvgHypXyiFvvAH5YRtSsc        Zvo9GI2e2MaZyo9/lvb+LbLEJZKEQckqRj4P26gmASrZEPStwc+yqy1ShHLA0j6m        1QIDAQAB        -----END PUBLIC KEY-----" | sed 's/   */
    /g' > "/etc/apk/keys/sgerrand.rsa.pub" &&     wget         "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME"         "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME"         "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" &&     apk add --no-cache         "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME"         "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME"         "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" &&         rm "/etc/apk/keys/sgerrand.rsa.pub" &&     /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true &&     echo "export LANG=$LANG" > /etc/profile.d/locale.sh &&         apk del glibc-i18n &&         rm "/root/.wget-hsts" &&     apk del .build-dependencies &&     rm         "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME"         "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME"         "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME"
     ---> Running in b7c8d8334cd2
    fetch https://mirrors.aliyun.com/alpine/latest-stable/main/x86_64/APKINDEX.tar.gz
    fetch https://mirrors.aliyun.com/alpine/latest-stable/community/x86_64/APKINDEX.tar.gz
    (1/5) Installing libunistring (0.9.10-r1)
    (2/5) Installing libidn2 (2.3.1-r0)
    (3/5) Installing wget (1.21.1-r1)
    (4/5) Installing ca-certificates (20191127-r5)
    (5/5) Installing .build-dependencies (20210831.025019)
    Executing busybox-1.33.1-r3.trigger
    Executing ca-certificates-20191127-r5.trigger
    OK: 8 MiB in 19 packages
    --2021-08-31 02:50:20--  https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-2.34-r0.apk
    Resolving github.com (github.com)... 20.205.243.166
    Connecting to github.com (github.com)|20.205.243.166|:443... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: https://github-releases.githubusercontent.com/33333969/ce45952b-d576-4b49-96c8-934409fb4c9b?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210831%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210831T025021Z&X-Amz-Expires=300&X-Amz-Signature=caebe71090dd00bbec9816d358b9905ab9693e94beb74532e4966019dc33c629&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=33333969&response-content-disposition=attachment%3B%20filename%3Dglibc-2.34-r0.apk&response-content-type=application%2Fvnd.android.package-archive [following]
    --2021-08-31 02:50:21--  https://github-releases.githubusercontent.com/33333969/ce45952b-d576-4b49-96c8-934409fb4c9b?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210831%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210831T025021Z&X-Amz-Expires=300&X-Amz-Signature=caebe71090dd00bbec9816d358b9905ab9693e94beb74532e4966019dc33c629&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=33333969&response-content-disposition=attachment%3B%20filename%3Dglibc-2.34-r0.apk&response-content-type=application%2Fvnd.android.package-archive
    Resolving github-releases.githubusercontent.com (github-releases.githubusercontent.com)... 185.199.110.154, 185.199.109.154, 185.199.111.154, ...
    Connecting to github-releases.githubusercontent.com (github-releases.githubusercontent.com)|185.199.110.154|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 1940882 (1.9M) [application/vnd.android.package-archive]
    Saving to: 'glibc-2.34-r0.apk'
    
         0K .......... .......... .......... .......... ..........  2%  114K 16s
        50K .......... .......... .......... .......... ..........  5% 5.84K 2m41s
       100K .......... .......... .......... .......... ..........  7% 15.6K 2m22s
       150K .......... .......... .......... .......... .......... 10% 11.2K 2m21s
       200K .......... .......... .......... .......... .......... 13% 17.5K 2m8s
       250K .......... .......... .......... .......... .......... 15% 11.8K 2m6s
       300K .......... .......... .......... .......... .......... 18% 32.0K 1m52s
       350K .......... .......... .......... .......... .......... 21% 8.51K 1m57s
       400K .......... .......... .......... .......... .......... 23% 9.50K 1m57s
       450K .......... .......... .......... .......... .......... 26% 9.30K 1m57s
       500K .......... .......... .......... .......... .......... 29% 28.7K 1m47s
       550K .......... .......... .......... .......... .......... 31% 14.9K 1m41s
       600K .......... .......... .......... .......... .......... 34% 7.78K 1m42s
       650K .......... .......... .......... .......... .......... 36% 8.19K 1m42s
       700K .......... .......... .......... .......... .......... 39% 13.5K 96s
       750K .......... .......... .......... .......... .......... 42% 16.2K 91s
       800K .......... .......... .......... .......... .......... 44% 12.3K 86s
       850K .......... .......... .......... .......... .......... 47% 8.41K 84s
       900K .......... .......... .......... .......... .......... 50% 18.0K 79s
       950K .......... .......... .......... .......... .......... 52% 10.8K 75s
      1000K .......... .......... .......... .......... .......... 55% 15.1K 70s
      1050K .......... .......... .......... .......... .......... 58% 19.1K 65s
      1100K .......... .......... .......... .......... .......... 60% 10.9K 61s
      1150K .......... .......... .......... .......... .......... 63% 10.7K 57s
      1200K .......... .......... .......... .......... .......... 65% 9.54K 54s
      1250K .......... .......... .......... .......... .......... 68% 12.4K 50s
      1300K .......... .......... .......... .......... .......... 71% 22.0K 45s
      1350K .......... .......... .......... .......... .......... 73% 21.3K 40s
      1400K .......... .......... .......... .......... .......... 76% 19.7K 35s
      1450K .......... .......... .......... .......... .......... 79% 10.3K 32s
      1500K .......... .......... .......... .......... .......... 81% 5.61K 29s
      1550K .......... .......... .......... .......... .......... 84% 8.23K 25s
      1600K .......... .......... .......... .......... .......... 87% 14.2K 21s
      1650K .......... .......... .......... .......... .......... 89% 9.63K 17s
      1700K .......... .......... .......... .......... .......... 92% 17.5K 12s
      1750K .......... .......... .......... .......... .......... 94% 9.28K 8s
      1800K .......... .......... .......... .......... .......... 97% 15.7K 4s
      1850K .......... .......... .......... .......... .....     100% 12.9K=2m39s
    
    2021-08-31 02:53:02 (11.9 KB/s) - 'glibc-2.34-r0.apk' saved [1940882/1940882]
    
    --2021-08-31 02:53:02--  https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-bin-2.34-r0.apk
    Connecting to github.com (github.com)|20.205.243.166|:443... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: https://github-releases.githubusercontent.com/33333969/afede576-1811-4fca-93c9-4cdf0cbba111?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210831%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210831T025303Z&X-Amz-Expires=300&X-Amz-Signature=87d5bff6222f74ebad8464223428ecaaea37a391ac8e6a9e71f9b3c96cb8c9e6&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=33333969&response-content-disposition=attachment%3B%20filename%3Dglibc-bin-2.34-r0.apk&response-content-type=application%2Fvnd.android.package-archive [following]
    --2021-08-31 02:53:03--  https://github-releases.githubusercontent.com/33333969/afede576-1811-4fca-93c9-4cdf0cbba111?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210831%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210831T025303Z&X-Amz-Expires=300&X-Amz-Signature=87d5bff6222f74ebad8464223428ecaaea37a391ac8e6a9e71f9b3c96cb8c9e6&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=33333969&response-content-disposition=attachment%3B%20filename%3Dglibc-bin-2.34-r0.apk&response-content-type=application%2Fvnd.android.package-archive
    Connecting to github-releases.githubusercontent.com (github-releases.githubusercontent.com)|185.199.110.154|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 1120265 (1.1M) [application/vnd.android.package-archive]
    Saving to: 'glibc-bin-2.34-r0.apk'
    
         0K .......... .......... .......... .......... ..........  4% 8.46K 2m3s
        50K .......... .......... .......... .......... ..........  9% 13.5K 95s
       100K .......... .......... .......... .......... .......... 13% 22.4K 74s
       150K .......... .......... .......... .......... .......... 18% 14.9K 68s
       200K .......... .......... .......... .......... .......... 22% 16.5K 61s
       250K .......... .......... .......... .......... .......... 27% 9.41K 62s
       300K .......... .......... .......... .......... .......... 31% 9.91K 61s
       350K .......... .......... .......... .......... .......... 36% 13.8K 56s
       400K .......... .......... .......... .......... .......... 41% 14.7K 51s
       450K .......... .......... .......... .......... .......... 45% 7.42K 50s
       500K .......... .......... .......... .......... .......... 50% 7.43K 49s
       550K .......... .......... .......... .......... .......... 54% 13.6K 43s
       600K .......... .......... .......... .......... .......... 59% 9.09K 40s
       650K .......... .......... .......... .......... .......... 63% 2.98K 42s
       700K .......... .......... .......... .......... .......... 68% 10.1K 37s
       750K .......... .......... .......... .......... .......... 73% 9.77K 31s
       800K .......... .......... .......... .......... .......... 77% 11.3K 26s
       850K .......... .......... .......... .......... .......... 82% 6.25K 21s
       900K .......... .......... .......... .......... .......... 86% 10.3K 16s
       950K .......... .......... .......... .......... .......... 91% 4.55K 11s
      1000K .......... .......... .......... .......... .......... 95% 9.57K 5s
      1050K .......... .......... .......... .......... ....      100% 13.0K=2m2s
    
    2021-08-31 02:55:06 (8.97 KB/s) - 'glibc-bin-2.34-r0.apk' saved [1120265/1120265]
    
    --2021-08-31 02:55:06--  https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-i18n-2.34-r0.apk
    Connecting to github.com (github.com)|20.205.243.166|:443... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: https://github-releases.githubusercontent.com/33333969/c0f9ba23-4338-430d-844a-16190ebba9a7?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210831%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210831T025507Z&X-Amz-Expires=300&X-Amz-Signature=f6bb97c73430f1268853af0b8ec066df19ce76261030e264918ec3793e363ec3&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=33333969&response-content-disposition=attachment%3B%20filename%3Dglibc-i18n-2.34-r0.apk&response-content-type=application%2Fvnd.android.package-archive [following]
    --2021-08-31 02:55:07--  https://github-releases.githubusercontent.com/33333969/c0f9ba23-4338-430d-844a-16190ebba9a7?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210831%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210831T025507Z&X-Amz-Expires=300&X-Amz-Signature=f6bb97c73430f1268853af0b8ec066df19ce76261030e264918ec3793e363ec3&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=33333969&response-content-disposition=attachment%3B%20filename%3Dglibc-i18n-2.34-r0.apk&response-content-type=application%2Fvnd.android.package-archive
    Connecting to github-releases.githubusercontent.com (github-releases.githubusercontent.com)|185.199.110.154|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 7766693 (7.4M) [application/vnd.android.package-archive]
    Saving to: 'glibc-i18n-2.34-r0.apk'
    
         0K .......... .......... .......... .......... ..........  0%  181K 42s
        50K .......... .......... .......... .......... ..........  1%  192K 40s
       100K .......... .......... .......... .......... ..........  1% 82.7K 57s
       150K .......... .......... .......... .......... ..........  2% 43.1K 85s
       200K .......... .......... .......... .......... ..........  3% 15.0K 2m46s
       250K .......... .......... .......... .......... ..........  3% 26.2K 3m3s
       300K .......... .......... .......... .......... ..........  4% 29.2K 3m12s
       350K .......... .......... .......... .......... ..........  5% 18.9K 3m34s
       400K .......... .......... .......... .......... ..........  5% 19.3K 3m50s
       450K .......... .......... .......... .......... ..........  6% 16.9K 4m8s
       500K .......... .......... .......... .......... ..........  7% 21.8K 4m13s
       550K .......... .......... .......... .......... ..........  7% 15.3K 4m28s
       600K .......... .......... .......... .......... ..........  8% 38.8K 4m19s
       650K .......... .......... .......... .......... ..........  9% 14.2K 4m34s
       700K .......... .......... .......... .......... ..........  9% 22.0K 4m34s
       750K .......... .......... .......... .......... .......... 10% 36.1K 4m27s
       800K .......... .......... .......... .......... .......... 11% 20.2K 4m29s
       850K .......... .......... .......... .......... .......... 11% 26.7K 4m26s
       900K .......... .......... .......... .......... .......... 12% 29.4K 4m22s
       950K .......... .......... .......... .......... .......... 13% 47.7K 4m14s
      1000K .......... .......... .......... .......... .......... 13% 41.8K 4m8s
      1050K .......... .......... .......... .......... .......... 14% 26.6K 4m6s
      1100K .......... .......... .......... .......... .......... 15% 33.8K 4m1s
      1150K .......... .......... .......... .......... .......... 15% 27.6K 3m59s
      1200K .......... .......... .......... .......... .......... 16% 26.4K 3m58s
      1250K .......... .......... .......... .......... .......... 17% 21.4K 3m58s
      1300K .......... .......... .......... .......... .......... 17% 21.2K 3m58s
      1350K .......... .......... .......... .......... .......... 18% 33.2K 3m54s
      1400K .......... .......... .......... .......... .......... 19% 35.0K 3m51s
      1450K .......... .......... .......... .......... .......... 19% 19.3K 3m52s
      1500K .......... .......... .......... .......... .......... 20% 18.3K 3m53s
      1550K .......... .......... .......... .......... .......... 21% 16.2K 3m55s
      1600K .......... .......... .......... .......... .......... 21% 27.0K 3m53s
      1650K .......... .......... .......... .......... .......... 22% 12.4K 3m58s
      1700K .......... .......... .......... .......... .......... 23% 30.7K 3m55s
      1750K .......... .......... .......... .......... .......... 23% 35.1K 3m51s
      1800K .......... .......... .......... .......... .......... 24% 24.3K 3m49s
      1850K .......... .......... .......... .......... .......... 25% 13.1K 3m52s
      1900K .......... .......... .......... .......... .......... 25% 22.5K 3m51s
      1950K .......... .......... .......... .......... .......... 26% 16.3K 3m52s
      2000K .......... .......... .......... .......... .......... 27% 9.47K 3m58s
      2050K .......... .......... .......... .......... .......... 27% 25.7K 3m56s
      2100K .......... .......... .......... .......... .......... 28% 39.2K 3m51s
      2150K .......... .......... .......... .......... .......... 29% 28.3K 3m48s
      2200K .......... .......... .......... .......... .......... 29% 23.2K 3m46s
      2250K .......... .......... .......... .......... .......... 30% 28.9K 3m43s
      2300K .......... .......... .......... .......... .......... 30% 21.7K 3m41s
      2350K .......... .......... .......... .......... .......... 31% 20.7K 3m40s
      2400K .......... .......... .......... .......... .......... 32% 14.3K 3m41s
      2450K .......... .......... .......... .......... .......... 32% 24.3K 3m38s
      2500K .......... .......... .......... .......... .......... 33% 19.6K 3m37s
      2550K .......... .......... .......... .......... .......... 34% 17.2K 3m36s
      2600K .......... .......... .......... .......... .......... 34% 23.5K 3m34s
      2650K .......... .......... .......... .......... .......... 35% 16.7K 3m33s
      2700K .......... .......... .......... .......... .......... 36% 14.8K 3m33s
      2750K .......... .......... .......... .......... .......... 36% 45.4K 3m29s
      2800K .......... .......... .......... .......... .......... 37% 17.4K 3m28s
      2850K .......... .......... .......... .......... .......... 38% 24.4K 3m26s
      2900K .......... .......... .......... .......... .......... 38% 12.1K 3m27s
      2950K .......... .......... .......... .......... .......... 39% 19.8K 3m25s
      3000K .......... .......... .......... .......... .......... 40% 17.7K 3m23s
      3050K .......... .......... .......... .......... .......... 40% 19.2K 3m22s
      3100K .......... .......... .......... .......... .......... 41% 17.3K 3m20s
      3150K .......... .......... .......... .......... .......... 42% 20.5K 3m18s
      3200K .......... .......... .......... .......... .......... 42% 17.4K 3m17s
      3250K .......... .......... .......... .......... .......... 43% 25.0K 3m14s
      3300K .......... .......... .......... .......... .......... 44% 21.5K 3m12s
      3350K .......... .......... .......... .......... .......... 44% 18.1K 3m10s
      3400K .......... .......... .......... .......... .......... 45% 23.6K 3m8s
      3450K .......... .......... .......... .......... .......... 46% 17.5K 3m6s
      3500K .......... .......... .......... .......... .......... 46% 12.7K 3m6s
      3550K .......... .......... .......... .......... .......... 47% 28.5K 3m3s
      3600K .......... .......... .......... .......... .......... 48% 12.7K 3m3s
      3650K .......... .......... .......... .......... .......... 48% 19.4K 3m1s
      3700K .......... .......... .......... .......... .......... 49% 17.0K 2m59s
      3750K .......... .......... .......... .......... .......... 50% 22.1K 2m56s
      3800K .......... .......... .......... .......... .......... 50% 27.3K 2m54s
      3850K .......... .......... .......... .......... .......... 51% 8.71K 2m55s
      3900K .......... .......... .......... .......... .......... 52% 23.6K 2m52s
      3950K .......... .......... .......... .......... .......... 52% 7.69K 2m53s
      4000K .......... .......... .......... .......... .......... 53% 20.7K 2m51s
      4050K .......... .......... .......... .......... .......... 54% 16.5K 2m49s
      4100K .......... .......... .......... .......... .......... 54% 27.5K 2m46s
      4150K .......... .......... .......... .......... .......... 55% 27.6K 2m43s
      4200K .......... .......... .......... .......... .......... 56% 10.8K 2m42s
      4250K .......... .......... .......... .......... .......... 56% 7.27K 2m43s
      4300K .......... .......... .......... .......... .......... 57% 26.9K 2m40s
      4350K .......... .......... .......... .......... .......... 58% 18.8K 2m38s
      4400K .......... .......... .......... .......... .......... 58% 29.0K 2m35s
      4450K .......... .......... .......... .......... .......... 59% 23.7K 2m32s
      4500K .......... .......... .......... .......... .......... 59% 14.4K 2m31s
      4550K .......... .......... .......... .......... .......... 60% 21.3K 2m28s
      4600K .......... .......... .......... .......... .......... 61% 23.0K 2m25s
      4650K .......... .......... .......... .......... .......... 61% 13.4K 2m24s
      4700K .......... .......... .......... .......... .......... 62% 24.8K 2m21s
      4750K .......... .......... .......... .......... .......... 63% 17.9K 2m19s
      4800K .......... .......... .......... .......... .......... 63% 18.1K 2m16s
      4850K .......... .......... .......... .......... .......... 64% 16.5K 2m14s
      4900K .......... .......... .......... .......... .......... 65% 13.5K 2m12s
      4950K .......... .......... .......... .......... .......... 65% 12.7K 2m10s
      5000K .......... .......... .......... .......... .......... 66% 30.8K 2m7s
      5050K .......... .......... .......... .......... .......... 67% 36.7K 2m4s
      5100K .......... .......... .......... .......... .......... 67% 33.5K 2m1s
      5150K .......... .......... .......... .......... .......... 68% 22.8K 1m59s
      5200K .......... .......... .......... .......... .......... 69% 26.5K 1m56s
      5250K .......... .......... .......... .......... .......... 69% 45.7K 1m53s
      5300K .......... .......... .......... .......... .......... 70% 42.6K 1m50s
      5350K .......... .......... .......... .......... .......... 71% 60.2K 1m47s
      5400K .......... .......... .......... .......... .......... 71% 28.1K 1m44s
      5450K .......... .......... .......... .......... .......... 72% 13.9K 1m42s
      5500K .......... .......... .......... .......... .......... 73% 23.6K 99s
      5550K .......... .......... .......... .......... .......... 73% 17.3K 97s
      5600K .......... .......... .......... .......... .......... 74% 20.6K 95s
      5650K .......... .......... .......... .......... .......... 75% 25.7K 92s
      5700K .......... .......... .......... .......... .......... 75% 25.7K 90s
      5750K .......... .......... .......... .......... .......... 76% 15.2K 87s
      5800K .......... .......... .......... .......... .......... 77% 19.8K 85s
      5850K .......... .......... .......... .......... .......... 77% 24.5K 82s
      5900K .......... .......... .......... .......... .......... 78% 25.1K 80s
      5950K .......... .......... .......... .......... .......... 79% 22.6K 77s
      6000K .......... .......... .......... .......... .......... 79% 21.8K 75s
      6050K .......... .......... .......... .......... .......... 80% 18.4K 72s
      6100K .......... .......... .......... .......... .......... 81% 20.2K 70s
      6150K .......... .......... .......... .......... .......... 81% 19.6K 68s
      6200K .......... .......... .......... .......... .......... 82% 19.7K 65s
      6250K .......... .......... .......... .......... .......... 83% 32.5K 63s
      6300K .......... .......... .......... .......... .......... 83% 22.9K 60s
      6350K .......... .......... .......... .......... .......... 84% 21.3K 58s
      6400K .......... .......... .......... .......... .......... 85% 22.7K 55s
      6450K .......... .......... .......... .......... .......... 85% 19.5K 53s
      6500K .......... .......... .......... .......... .......... 86% 34.4K 50s
      6550K .......... .......... .......... .......... .......... 87% 21.0K 48s
      6600K .......... .......... .......... .......... .......... 87% 19.6K 45s
      6650K .......... .......... .......... .......... .......... 88% 30.7K 43s
      6700K .......... .......... .......... .......... .......... 88% 22.9K 40s
      6750K .......... .......... .......... .......... .......... 89% 25.8K 38s
      6800K .......... .......... .......... .......... .......... 90% 15.3K 36s
      6850K .......... .......... .......... .......... .......... 90% 26.4K 33s
      6900K .......... .......... .......... .......... .......... 91% 17.9K 31s
      6950K .......... .......... .......... .......... .......... 92% 26.9K 28s
      7000K .......... .......... .......... .......... .......... 92% 20.3K 26s
      7050K .......... .......... .......... .......... .......... 93% 9.43K 24s
      7100K .......... .......... .......... .......... .......... 94% 15.2K 21s
      7150K .......... .......... .......... .......... .......... 94% 17.0K 19s
      7200K .......... .......... .......... .......... .......... 95% 35.1K 16s
      7250K .......... .......... .......... .......... .......... 96% 47.4K 14s
      7300K .......... .......... .......... .......... .......... 96% 35.7K 11s
      7350K .......... .......... .......... .......... .......... 97% 55.8K 9s
      7400K .......... .......... .......... .......... .......... 98% 35.8K 6s
      7450K .......... .......... .......... .......... .......... 98% 18.4K 4s
      7500K .......... .......... .......... .......... .......... 99% 25.9K 2s
      7550K .......... .......... .......... ....                 100% 48.4K=6m4s
    
    2021-08-31 03:01:11 (20.9 KB/s) - 'glibc-i18n-2.34-r0.apk' saved [7766693/7766693]
    
    FINISHED --2021-08-31 03:01:11--
    Total wall clock time: 10m 51s
    Downloaded: 3 files, 10M in 10m 44s (16.4 KB/s)
    fetch https://mirrors.aliyun.com/alpine/latest-stable/main/x86_64/APKINDEX.tar.gz
    fetch https://mirrors.aliyun.com/alpine/latest-stable/community/x86_64/APKINDEX.tar.gz
    (1/4) Installing glibc (2.34-r0)
    (2/4) Installing libgcc (10.3.1_git20210424-r2)
    (3/4) Installing glibc-bin (2.34-r0)
    (4/4) Installing glibc-i18n (2.34-r0)
    Executing glibc-bin-2.34-r0.trigger
    OK: 41 MiB in 23 packages
    [error] character map file `UTF-8' not found: No such file or directory
    [error] default character map file `ANSI_X3.4-1968' not found: No such file or directory
    WARNING: Ignoring https://mirrors.aliyun.com/alpine/latest-stable/main/: No such file or directory
    WARNING: Ignoring https://mirrors.aliyun.com/alpine/latest-stable/community/: No such file or directory
    (1/1) Purging glibc-i18n (2.34-r0)
    OK: 16 MiB in 22 packages
    (1/5) Purging .build-dependencies (20210831.025019)
    (2/5) Purging wget (1.21.1-r1)
    WARNING: Ignoring https://mirrors.aliyun.com/alpine/latest-stable/main/: No such file or directory
    WARNING: Ignoring https://mirrors.aliyun.com/alpine/latest-stable/community/: No such file or directory
    (3/5) Purging ca-certificates (20191127-r5)
    Executing ca-certificates-20191127-r5.post-deinstall
    (4/5) Purging libidn2 (2.3.1-r0)
    (5/5) Purging libunistring (0.9.10-r1)
    Executing busybox-1.33.1-r3.trigger
    Executing glibc-bin-2.34-r0.trigger
    OK: 13 MiB in 17 packages
    Removing intermediate container b7c8d8334cd2
     ---> 52ff41ea01af
    Step 5/5 : RUN  apk add -U tzdata curl && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && apk del tzdata && rm -rf /var/cache/apk/*
     ---> Running in d220e6d46df6
    fetch https://mirrors.aliyun.com/alpine/latest-stable/main/x86_64/APKINDEX.tar.gz
    fetch https://mirrors.aliyun.com/alpine/latest-stable/community/x86_64/APKINDEX.tar.gz
    (1/6) Installing ca-certificates (20191127-r5)
    (2/6) Installing brotli-libs (1.0.9-r5)
    (3/6) Installing nghttp2-libs (1.43.0-r0)
    (4/6) Installing libcurl (7.78.0-r0)
    (5/6) Installing curl (7.78.0-r0)
    (6/6) Installing tzdata (2021a-r0)
    Executing busybox-1.33.1-r3.trigger
    Executing ca-certificates-20191127-r5.trigger
    Executing glibc-bin-2.34-r0.trigger
    OK: 18 MiB in 23 packages
    (1/1) Purging tzdata (2021a-r0)
    Executing busybox-1.33.1-r3.trigger
    OK: 15 MiB in 22 packages
    Removing intermediate container d220e6d46df6
     ---> caafb8c6f7af
    Successfully built caafb8c6f7af
    Successfully tagged alpine_glibc:3.14.2
    

    注意,这个在编译的时候出现如下这个错误,不知道对后续使用这个有影响没,这个就有待后续研究了。

    [error] character map file `UTF-8' not found: No such file or directory
    [error] default character map file `ANSI_X3.4-1968' not found: No such file or directory
    

    然后替换Dockerfile文件中的FROM alpine:latest即可

    如上四个镜像大小比较

    # docker image ls|grep glibc
    alpine_glibc                                                        3.14.2              caafb8c6f7af        8 minutes ago       15.3MB
    alpine_glibc                                                        3.10                19233ea6669d        26 minutes ago      14MB
    jeanblanchard/alpine-glibc                                          latest              2e1bf678accc        9 days ago          13.2MB
    jlesage/baseimage                                                   alpine-3.7-glibc    7bde9ce1bc13        5 months ago        22.6MB
    

    考虑到后期维护以及镜像大小的因素,优先使用:jeanblanchard/alpine-glibc:latest

  • 相关阅读:
    flask 之定时任务开发
    locust 参数,数据详解
    ab返回结果参数分析
    ab使用命令
    django 实现同一个ip十分钟内只能注册一次(redis版本)
    django开发中利用 缓存文件 进行页面缓存
    django 实现登录时候输入密码错误5次锁定用户十分钟
    django 实现同一个ip十分钟内只能注册一次
    钉钉消息通知机器人python版
    用WMI监控IIS
  • 原文地址:https://www.cnblogs.com/sanduzxcvbnm/p/15194543.html
Copyright © 2020-2023  润新知