docker 创建 jdk 镜像
jdk 下载地址: https://www.oracle.com/technetwork/java/javase/downloads/jdk12-downloads-5295953.html下载jdk 1.8选择适合自己的jdk下载,linux版本选择下载==*.tar.gz==在服务器中/home目录一般是空间最大的目录,选择此目录创建镜像仓库mkdir /home/docker/...
·
jdk 下载地址: https://www.oracle.com/technetwork/java/javase/downloads/jdk12-downloads-5295953.html
下载jdk 1.8
选择适合自己的jdk下载,linux版本选择下载 *.tar.gz
在服务器中/home目录一般是空间最大的目录,选择此目录创建镜像仓库
mkdir /home/docker/jdk
cd /home/docker/jdk
wget jdk下载地址
创建dockerfile文件
vim Dockerfile
文件内容如下:
#依赖镜像名称和ID 使用 docker images 查看镜像和其id
FROM centos:7
#创建安装文件夹
RUN mkdir /usr/local/java
#A相对路径jar包添加到目录下
ADD jdk-8u211-linux-x64.tar.gz /usr/local/java/
#java环境变量
ENV JAVA_HOME /usr/local/java/jdk1.8.0_211
ENV JRE_HOME $JAVA_HOME/jre
ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
ENV PATH $JAVA_HOME/bin:$PATH
构建镜像
[root@master jdk]# docker build -t='jdk1.8' .
Sending build context to Docker daemon 195MB
Step 1/7 : FROM centos:7
---> 9f38484d220f
Step 2/7 : RUN mkdir /usr/local/java
---> Running in 5345080cf667
Removing intermediate container 5345080cf667
---> 5977605c7039
Step 3/7 : ADD jdk-8u211-linux-x64.tar.gz /usr/local/java/
---> f80d93474f6e
Step 4/7 : ENV JAVA_HOME /usr/local/java/jdk1.8.0_211
---> Running in a440e2a8ea13
Removing intermediate container a440e2a8ea13
---> a5ccbbbccf77
Step 5/7 : ENV JRE_HOME $JAVA_HOME/jre
---> Running in c05217736015
Removing intermediate container c05217736015
---> 78e90380f571
Step 6/7 : ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
---> Running in ccafb291a44a
Removing intermediate container ccafb291a44a
---> 98251aa157a3
Step 7/7 : ENV PATH $JAVA_HOME/bin:$PATH
---> Running in 7c6d3e2f8885
Removing intermediate container 7c6d3e2f8885
---> cd9610b4c7c4
Successfully built cd9610b4c7c4
Successfully tagged jdk1.8:latest
查看镜像是否成功
[root@master jdk]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
jdk1.8 latest cd9610b4c7c4 About a minute ago 608MB
<none> <none> 0d5fb3c3f262 25 minutes ago 608MB
composetest_web latest e64a11c69859 3 days ago 84.5MB
goharbor/chartmuseum-photon v0.8.1-v1.8.0 60a4caf66227 10 days ago 113MB
goharbor/harbor-migrator v1.8.0 765880263e76 10 days ago 361MB
goharbor/redis-photon v1.8.0 66d7402d2770 10 days ago 103MB
goharbor/clair-photon v2.0.8-v1.8.0 7570a336afd5 10 days ago 164MB
goharbor/notary-server-photon v0.6.1-v1.8.0 e8552306a936 10 days ago 135MB
goharbor/notary-signer-photon v0.6.1-v1.8.0 9736ac6c508e 10 days ago 132MB
goharbor/harbor-registryctl v1.8.0 0ca3e2b624f5 10 days ago 96.2MB
goharbor/registry-photon v2.7.1-patch-2819-v1.8.0 1e7d99ccba24 10 days ago 81.3MB
goharbor/nginx-photon v1.8.0 4a4b48b32ae4 10 days ago 36MB
goharbor/harbor-log v1.8.0 e718bdc405a3 10 days ago 81.5MB
goharbor/harbor-jobservice v1.8.0 d47940dd883f 10 days ago 118MB
goharbor/harbor-core v1.8.0 b07a1a4be17f 10 days ago 135MB
goharbor/harbor-portal v1.8.0 76298a1ef089 10 days ago 42.9MB
goharbor/harbor-db v1.8.0 d1e0b3df3e95 10 days ago 140MB
goharbor/prepare v1.8.0 769ca785dab0 10 days ago 139MB
redis alpine 72e76053ebb7 11 days ago 50.9MB
python 3.4-alpine c06adcf62f6e 2 months ago 72.9MB
centos 7 9f38484d220f 2 months ago 202MB
registry latest f32a97de94e1 2 months ago 25.8MB
hello-world latest fce289e99eb9 4 months ago 1.84kB
更多推荐
已为社区贡献5条内容
所有评论(0)