使用dockerfile for ARM64(MACOS-M1)配置构建Corretto-Java11高山图像

发布于 2025-02-03 09:05:57 字数 6292 浏览 5 评论 0原文

我正在尝试在Dockerfile的帮助下构建Java11的ARM64图像:

    FROM alpine:3.14    
ARG version=11.0.15.9.1    
RUN wget -O /THIRD-PARTY-LICENSES-20200824.tar.gz https://corretto.aws/downloads/resources/licenses/alpine/THIRD-PARTY-LICENSES-20200824.tar.gz && \    
    echo "82f3e50e71b2aee21321b2b33de372feed5befad6ef2196ddec92311bc09becb  /THIRD-PARTY-LICENSES-20200824.tar.gz" | sha256sum -c - && \    
    tar x -ovzf THIRD-PARTY-LICENSES-20200824.tar.gz && \   
    rm -rf THIRD-PARTY-LICENSES-20200824.tar.gz && \    
    wget -O /etc/apk/keys/amazoncorretto.rsa.pub https://apk.corretto.aws/amazoncorretto.rsa.pub && \   
    SHA_SUM="6cfdf08be09f32ca298e2d5bd4a359ee2b275765c09b56d514624bf831eafb91" && \ 
    echo "${SHA_SUM}  /etc/apk/keys/amazoncorretto.rsa.pub" | sha256sum -c - && \   
    echo "https://apk.corretto.aws" >> /etc/apk/repositories && \   
    apk add --no-cache amazon-corretto-11=$version-r0   
        
ENV LANG C.UTF-8    
ENV JAVA_HOME=/usr/lib/jvm/default-jvm  
ENV PATH=$PATH:/usr/lib/jvm/default-jvm/bin

在使用命令构建图像时,

 docker buildx build --platform=arm64 -t localhost:5000/java11 -f Dockerfile --push .

我会在日志中遇到以下错误:

[+] Building 7.1s (5/5) FINISHED                                                                                                                                                                           
 => [internal] load build definition from Dockerfile                                                                                                                                                  0.0s
 => => transferring dockerfile: 32B                                                                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/alpine:3.14                                                                                                                                        2.0s
 => CACHED [1/2] FROM docker.io/library/alpine:3.14@sha256:06b5d462c92fc39303e6363c65e074559f8d6b1363250027ed5053557e3398c5                                                                           0.0s
 => ERROR [2/2] RUN wget -O /THIRD-PARTY-LICENSES-20200824.tar.gz https://corretto.aws/downloads/resources/licenses/alpine/THIRD-PARTY-LICENSES-20200824.tar.gz &&     echo "82f3e50e71b2aee21321b2b  4.9s
------                                                                                                                                                                                                     
 > [2/2] RUN wget -O /THIRD-PARTY-LICENSES-20200824.tar.gz https://corretto.aws/downloads/resources/licenses/alpine/THIRD-PARTY-LICENSES-20200824.tar.gz &&     echo "82f3e50e71b2aee21321b2b33de372feed5befad6ef2196ddec92311bc09becb  /THIRD-PARTY-LICENSES-20200824.tar.gz" | sha256sum -c - &&     tar x -ovzf THIRD-PARTY-LICENSES-20200824.tar.gz &&     rm -rf THIRD-PARTY-LICENSES-20200824.tar.gz &&     wget -O /etc/apk/keys/amazoncorretto.rsa.pub https://apk.corretto.aws/amazoncorretto.rsa.pub &&     SHA_SUM="6cfdf08be09f32ca298e2d5bd4a359ee2b275765c09b56d514624bf831eafb91" &&     echo "${SHA_SUM}  /etc/apk/keys/amazoncorretto.rsa.pub" | sha256sum -c - &&     echo "https://apk.corretto.aws" >> /etc/apk/repositories &&     apk add --no-cache amazon-corretto-11=11.0.15.9.1-r0:                               
#0 0.599 Connecting to corretto.aws (18.66.53.31:443)                                                                                                                                                      
#0 0.899 saving to '/THIRD-PARTY-LICENSES-20200824.tar.gz'
#0 0.902 THIRD-PARTY-LICENSES 100% |********************************| 25807  0:00:00 ETA
#0 0.903 '/THIRD-PARTY-LICENSES-20200824.tar.gz' saved
#0 0.930 /THIRD-PARTY-LICENSES-20200824.tar.gz: OK
#0 0.962 licenses/THIRD-PARTY-LICENSES
#0 1.045 Connecting to apk.corretto.aws (108.159.80.19:443)
#0 1.343 saving to '/etc/apk/keys/amazoncorretto.rsa.pub'
#0 1.346 amazoncorretto.rsa.p 100% |********************************|   451  0:00:00 ETA
#0 1.347 '/etc/apk/keys/amazoncorretto.rsa.pub' saved
#0 1.370 /etc/apk/keys/amazoncorretto.rsa.pub: OK
#0 1.432 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/aarch64/APKINDEX.tar.gz
#0 2.420 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/aarch64/APKINDEX.tar.gz
#0 3.315 fetch https://apk.corretto.aws/aarch64/APKINDEX.tar.gz
#0 4.287 WARNING: Ignoring https://apk.corretto.aws: Permission denied
#0 4.720 ERROR: unable to select packages:
#0 4.869   amazon-corretto-11 (no such package):
#0 4.869     required by: world[amazon-corretto-11=11.0.15.9.1-r0]
------
error: failed to solve: executor failed running [/bin/sh -c wget -O /THIRD-PARTY-LICENSES-20200824.tar.gz https://corretto.aws/downloads/resources/licenses/alpine/THIRD-PARTY-LICENSES-20200824.tar.gz &&     echo "82f3e50e71b2aee21321b2b33de372feed5befad6ef2196ddec92311bc09becb  /THIRD-PARTY-LICENSES-20200824.tar.gz" | sha256sum -c - &&     tar x -ovzf THIRD-PARTY-LICENSES-20200824.tar.gz &&     rm -rf THIRD-PARTY-LICENSES-20200824.tar.gz &&     wget -O /etc/apk/keys/amazoncorretto.rsa.pub https://apk.corretto.aws/amazoncorretto.rsa.pub &&     SHA_SUM="6cfdf08be09f32ca298e2d5bd4a359ee2b275765c09b56d514624bf831eafb91" &&     echo "${SHA_SUM}  /etc/apk/keys/amazoncorretto.rsa.pub" | sha256sum -c - &&     echo "https://apk.corretto.aws" >> /etc/apk/repositories &&     apk add --no-cache amazon-corretto-11=$version-r0]: exit code: 1

Corretto支持Alpine Arm64 Architecture吗?

I am trying to build the arm64 image of java11 with the help of Dockerfile as follows:

    FROM alpine:3.14    
ARG version=11.0.15.9.1    
RUN wget -O /THIRD-PARTY-LICENSES-20200824.tar.gz https://corretto.aws/downloads/resources/licenses/alpine/THIRD-PARTY-LICENSES-20200824.tar.gz && \    
    echo "82f3e50e71b2aee21321b2b33de372feed5befad6ef2196ddec92311bc09becb  /THIRD-PARTY-LICENSES-20200824.tar.gz" | sha256sum -c - && \    
    tar x -ovzf THIRD-PARTY-LICENSES-20200824.tar.gz && \   
    rm -rf THIRD-PARTY-LICENSES-20200824.tar.gz && \    
    wget -O /etc/apk/keys/amazoncorretto.rsa.pub https://apk.corretto.aws/amazoncorretto.rsa.pub && \   
    SHA_SUM="6cfdf08be09f32ca298e2d5bd4a359ee2b275765c09b56d514624bf831eafb91" && \ 
    echo "${SHA_SUM}  /etc/apk/keys/amazoncorretto.rsa.pub" | sha256sum -c - && \   
    echo "https://apk.corretto.aws" >> /etc/apk/repositories && \   
    apk add --no-cache amazon-corretto-11=$version-r0   
        
ENV LANG C.UTF-8    
ENV JAVA_HOME=/usr/lib/jvm/default-jvm  
ENV PATH=$PATH:/usr/lib/jvm/default-jvm/bin

While building the image with command

 docker buildx build --platform=arm64 -t localhost:5000/java11 -f Dockerfile --push .

I am getting the following error in logs:

[+] Building 7.1s (5/5) FINISHED                                                                                                                                                                           
 => [internal] load build definition from Dockerfile                                                                                                                                                  0.0s
 => => transferring dockerfile: 32B                                                                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/alpine:3.14                                                                                                                                        2.0s
 => CACHED [1/2] FROM docker.io/library/alpine:3.14@sha256:06b5d462c92fc39303e6363c65e074559f8d6b1363250027ed5053557e3398c5                                                                           0.0s
 => ERROR [2/2] RUN wget -O /THIRD-PARTY-LICENSES-20200824.tar.gz https://corretto.aws/downloads/resources/licenses/alpine/THIRD-PARTY-LICENSES-20200824.tar.gz &&     echo "82f3e50e71b2aee21321b2b  4.9s
------                                                                                                                                                                                                     
 > [2/2] RUN wget -O /THIRD-PARTY-LICENSES-20200824.tar.gz https://corretto.aws/downloads/resources/licenses/alpine/THIRD-PARTY-LICENSES-20200824.tar.gz &&     echo "82f3e50e71b2aee21321b2b33de372feed5befad6ef2196ddec92311bc09becb  /THIRD-PARTY-LICENSES-20200824.tar.gz" | sha256sum -c - &&     tar x -ovzf THIRD-PARTY-LICENSES-20200824.tar.gz &&     rm -rf THIRD-PARTY-LICENSES-20200824.tar.gz &&     wget -O /etc/apk/keys/amazoncorretto.rsa.pub https://apk.corretto.aws/amazoncorretto.rsa.pub &&     SHA_SUM="6cfdf08be09f32ca298e2d5bd4a359ee2b275765c09b56d514624bf831eafb91" &&     echo "${SHA_SUM}  /etc/apk/keys/amazoncorretto.rsa.pub" | sha256sum -c - &&     echo "https://apk.corretto.aws" >> /etc/apk/repositories &&     apk add --no-cache amazon-corretto-11=11.0.15.9.1-r0:                               
#0 0.599 Connecting to corretto.aws (18.66.53.31:443)                                                                                                                                                      
#0 0.899 saving to '/THIRD-PARTY-LICENSES-20200824.tar.gz'
#0 0.902 THIRD-PARTY-LICENSES 100% |********************************| 25807  0:00:00 ETA
#0 0.903 '/THIRD-PARTY-LICENSES-20200824.tar.gz' saved
#0 0.930 /THIRD-PARTY-LICENSES-20200824.tar.gz: OK
#0 0.962 licenses/THIRD-PARTY-LICENSES
#0 1.045 Connecting to apk.corretto.aws (108.159.80.19:443)
#0 1.343 saving to '/etc/apk/keys/amazoncorretto.rsa.pub'
#0 1.346 amazoncorretto.rsa.p 100% |********************************|   451  0:00:00 ETA
#0 1.347 '/etc/apk/keys/amazoncorretto.rsa.pub' saved
#0 1.370 /etc/apk/keys/amazoncorretto.rsa.pub: OK
#0 1.432 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/aarch64/APKINDEX.tar.gz
#0 2.420 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/aarch64/APKINDEX.tar.gz
#0 3.315 fetch https://apk.corretto.aws/aarch64/APKINDEX.tar.gz
#0 4.287 WARNING: Ignoring https://apk.corretto.aws: Permission denied
#0 4.720 ERROR: unable to select packages:
#0 4.869   amazon-corretto-11 (no such package):
#0 4.869     required by: world[amazon-corretto-11=11.0.15.9.1-r0]
------
error: failed to solve: executor failed running [/bin/sh -c wget -O /THIRD-PARTY-LICENSES-20200824.tar.gz https://corretto.aws/downloads/resources/licenses/alpine/THIRD-PARTY-LICENSES-20200824.tar.gz &&     echo "82f3e50e71b2aee21321b2b33de372feed5befad6ef2196ddec92311bc09becb  /THIRD-PARTY-LICENSES-20200824.tar.gz" | sha256sum -c - &&     tar x -ovzf THIRD-PARTY-LICENSES-20200824.tar.gz &&     rm -rf THIRD-PARTY-LICENSES-20200824.tar.gz &&     wget -O /etc/apk/keys/amazoncorretto.rsa.pub https://apk.corretto.aws/amazoncorretto.rsa.pub &&     SHA_SUM="6cfdf08be09f32ca298e2d5bd4a359ee2b275765c09b56d514624bf831eafb91" &&     echo "${SHA_SUM}  /etc/apk/keys/amazoncorretto.rsa.pub" | sha256sum -c - &&     echo "https://apk.corretto.aws" >> /etc/apk/repositories &&     apk add --no-cache amazon-corretto-11=$version-r0]: exit code: 1

Does corretto support alpine arm64 architecture?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文