Docker构建java8最小docker镜像
一、现在java的JDK包
https://www.oracle.com/java/technologies/javase-server-jre8-downloads.html
二、解压文件
tar -xvzf jre-8u301-linux-x64.tar.gz
三、删除无用的文件
切换到解压的目录
rm -rf COPYRIGHT LICENSE README release THIRDPARTYLICENSEREADME-JAVAFX.txt THIRDPARTYLICENSEREADME.txt Welcome.html
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 jre1.8.0_301.tar.gz *
五、编写Dockerfile文件
FROM docker.io/jeanblanchard/alpine-glibc
MAINTAINER wuzhiyong
ADD jre8.tar.gz /usr/java/jdk/
ENV JAVA_HOME /usr/java/jdk
ENV PATH ${PATH}:${JAVA_HOME}/bin
WORKDIR /opt
六、构建镜像
docker build -t zgeo:java8 .
七、Tag镜像
docker tag zgeo:java8 <yourhost>/library/zgeo:java8
八、上传镜像
docker push <yourhost>/library/zgeo:java8