步骤

Dockerfile

  1. FROM centos:centos7
  2. MAINTAINER xxx "tianyunperfect@gmail.com"
  3. WORKDIR /jdk
  4. ADD jdk-8u261-linux-x64.tar.gz /jdk/
  5. ENV JAVA_HOME=/jdk/jdk1.8.0_261
  6. ENV CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
  7. ENV PATH=$JAVA_HOME/bin:$PATH
  8. CMD ["java","-version"]

构建

  1. docker build -t jdk8:8u261 .

推送

  1. # 推送
  2. docker login --username=tianyunperfect registry.cn-hongkong.aliyuncs.com
  3. docker tag jdk8:8u261 registry.cn-hongkong.aliyuncs.com/tianyunperfect/jdk8:8u261
  4. docker push registry.cn-hongkong.aliyuncs.com/tianyunperfect/jdk8:8u261

拉取

  1. docker pull registry.cn-hongkong.aliyuncs.com/tianyunperfect/jdk8:8u261

已上传

centos7

  1. docker pull registry.cn-hongkong.aliyuncs.com/tianyunperfect/centos:7

jdk8

  1. docker pull registry.cn-hongkong.aliyuncs.com/tianyunperfect/jdk8:8u261