步骤
Dockerfile
FROM centos:centos7
MAINTAINER xxx "tianyunperfect@gmail.com"
WORKDIR /jdk
ADD jdk-8u261-linux-x64.tar.gz /jdk/
ENV JAVA_HOME=/jdk/jdk1.8.0_261
ENV CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV PATH=$JAVA_HOME/bin:$PATH
CMD ["java","-version"]
构建
docker build -t jdk8:8u261 .
推送
# 推送
docker login --username=tianyunperfect registry.cn-hongkong.aliyuncs.com
docker tag jdk8:8u261 registry.cn-hongkong.aliyuncs.com/tianyunperfect/jdk8:8u261
docker push registry.cn-hongkong.aliyuncs.com/tianyunperfect/jdk8:8u261
拉取
docker pull registry.cn-hongkong.aliyuncs.com/tianyunperfect/jdk8:8u261
已上传
centos7
docker pull registry.cn-hongkong.aliyuncs.com/tianyunperfect/centos:7
jdk8
docker pull registry.cn-hongkong.aliyuncs.com/tianyunperfect/jdk8:8u261