准备JDK并删除一些不必要文件
tar xf jdk-8u60-linux-x64.tar.gz
cd jdk1.8.0_60/
rm -rf README.html COPYRIGHT LICENSE THIRDPARTYLICENSEREADME-JAVAFX.txt THIRDPARTYLICENSEREADME.txt
cd jre/lib/
rm -rf plugin.jar \
jfxswt.jar \
javaws.jar \
desktop \
deploy* \
javafx.properties \
jfxswt.jar \
amd64/libdecora_sse.so \
amd64/libprism_*.so \
amd64/libfxplugins.so \
amd64/libglass.so \
amd64/libgstreamer-lite.so \
amd64/libjfx*.so
tar zcf jdk1.8.0_60.tar.gz jdk1.8.0_60
创建Dockerfile
vi Dockerfile
#基础镜像
FROM xiaoxijin/apline
#安装glibc依赖
RUN apk update
RUN apk add glibc
#安装JDK
ADD ./jdk1.8.0_60.tar.gz /usr/local/
#设置环境变量
ENV JAVA_HOME /usr/java/jdk
ENV PATH ${PATH}:${JAVA_HOME}/bin
构建镜像
docker build -t jdk_apline .