docker构建JDK最小镜像

1、解压jre 并 删除无用文件 重新打包

wget https://repo.huaweicloud.com/java/jdk/8u181-b13/jdk-8u181-linux-x64.tar.gz
tar -xvzf jdk-8u181-linux-x64.tar.gz 

cd jdk1.8.0_181/jre/
rm -rf COPYRIGHT LICENSE README release THIRDPARTYLICENSEREADME-JAVAFX.txt THIRDPARTYLICENSEREADME.txt Welcome.html javafx-src.zip src.zip
rm -rf   lib/plugin.jar \
           lib/ext/jfxrt.jar \
           bin/javaws \
           lib/javaws.jar \
           lib/desktop \
           plugin \
           lib/deploy* \
           lib/*javafx* \
           lib/*jfx* \
           lib/amd64/libdecora_sse.so \
           lib/amd64/libprism_*.so \
           lib/amd64/libfxplugins.so \
           lib/amd64/libglass.so \
           lib/amd64/libgstreamer-lite.so \
           lib/amd64/libjavafx*.so \
           lib/amd64/libjfx*.so

tar zcvf java1.8.tar.gz *

3、新建 Dockerfile

FROM docker.io/jeanblanchard/alpine-glibc
MAINTAINER tengfei.li
ADD java1.8.tar.gz /usr/java/jdk/
ENV JAVA_HOME /usr/java/jdk
ENV PATH ${PATH}:${JAVA_HOME}/bin

4、构建docker镜像

docker build -t java8:1.0 .
posted @ 2021-11-16 17:52  鸣昊  阅读(455)  评论(0编辑  收藏  举报