jdk打成镜像
https://gitee.com/yezhihao/jt808-server/
http://www.javashuo.com/article/p-zhytndul-p.html
下载官网jdk
百度网盘地址:https://pan.baidu.com/s/1o-O7Fifp4ID1limEmPTvGQ 提取码:vhst
上传到liunx服务器上并解压
[root@master20-154 temp]# tar -zxvf jdk-8u211-linux-x64.tar.gz
[root@master20-154 temp]# ls
jdk1.8.0_211 jdk-8u211-linux-x64.tar.gz
删除说明文档与无用的包
[root@master20-154 temp]# cd jdk1.8.0_211/
[root@master20-154 jdk1.8.0_211]# ls
bin COPYRIGHT include javafx-src.zip jre lib LICENSE man README.html release src.zip THIRDPARTYLICENSEREADME-JAVAFX.txt THIRDPARTYLICENSEREADME.txt
[root@master20-154 jdk1.8.0_211]# rm -rf COPYRIGHT LICENSE README release THIRDPARTYLICENSEREADME-JAVAFX.txt THIRDPARTYLICENSEREADME.txt Welcome.html
[root@master20-154 jdk1.8.0_211]# 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
重新打包
[root@master20-154 temp]# tar zcvf jdk8.tar.gz jdk8_211/
当前目录编写Dockerfile
[root@master20-154 temp]# vim Dockerfile
#jdk8u211 image
FROM jeanblanchard/alpine-glibc
ARG JAVA="jdk8_211"
ADD $JAVA.tar.gz /usr/local/
# configuration of java ENV
ENV JAVA_HOME /usr/local/jdk8_211
ENV JRE_HOME $JAVA_HOME/jre
ENV CLASSPATH $JAVA_HOME/lib/:$JRE_HOME/lib/
ENV PATH $PATH:$JAVA_HOME/bin
生成新的镜像
[root@master20-154 temp]# docker build -t jdk8:211 .
Sending build context to Docker daemon 789.2MB
Step 1/7 : FROM docker.io/jeanblanchard/alpine-glibc
latest: Pulling from jeanblanchard/alpine-glibc
213ec9aee27d: Pull complete
56ab3487b1d0: Pull complete
Digest: sha256:2a1b4830a3d6c1135c58bb25d5cf782471b3667d020870073d3431c57e01c045
Status: Downloaded newer image for jeanblanchard/alpine-glibc:latest
---> bb42782f371a
Step 2/7 : ARG JAVA="jdk-8u211-linux-x64"
---> Running in aef3d7874632
Removing intermediate container aef3d7874632
---> c8323299d97c
Step 3/7 : ADD $JAVA.tar.gz /usr/local/
---> 856a4707cc43
Step 4/7 : ENV JAVA_HOME /usr/local/jdk1.8.0_211
---> Running in a39c80203b2d
Removing intermediate container a39c80203b2d
---> 56ab0b5bb8a8
Step 5/7 : ENV JRE_HOME $JAVA_HOME/jre
---> Running in 3f354fec115a
Removing intermediate container 3f354fec115a
---> 772034a12849
Step 6/7 : ENV CLASSPATH $JAVA_HOME/lib/:$JRE_HOME/lib/
---> Running in 5d6e2b6da6d7
Removing intermediate container 5d6e2b6da6d7
---> 9392fbe1f541
Step 7/7 : ENV PATH $PATH:$JAVA_HOME/bin
---> Running in a0a50cd52ce9
Removing intermediate container a0a50cd52ce9
---> 4de4d60a8637
Successfully built 4de4d60a8637
Successfully tagged jdk8:211
注意:本文归作者所有,未经作者允许,不得转载