docker java
jdk-8u201-linux-x64.tar.gz 放在同一个目录
创建:Dockerfile
FROM centos:centos7
MAINTAINER Sunny
RUN mkdir /usr/local/jdk
WORKDIR /usr/local/jdk
ADD jdk-8u231-linux-x64.tar.gz /usr/local/jdk
ENV JAVA_HOME /usr/local/jdk/jdk1.8.0_231
ENV JRE_HOME /usr/local/jdk/jdk1.8.0_231/jre
ENV PATH $JAVA_HOME/bin:$PATH
建立镜像:
docker build -t jdk18 .
启动镜像:
docker run -di --name=jdk18 jdk18
进入镜像:
docker exec -it jdk18 /bin/bash