Docker installation and introduction of reference
1. Operating Environment: CentOS 7, Docker, jdk installation package I use jdk-8u231-linux-x64.tar.gz
2. Download a Docker centos7 container and check
# Download mirrors
Docker pull CentOS: 7
Is there centos # cuvette list: 7
Docker ImagesRF Royalty Free
3. Write Dockerfile
First jdk installation package copy to your current directory operations. I tried to use absolute paths but there are problems.
# New File Touch Dockerfile Edit the file # vim Dockerfile # Add the following ################################ From centos:7 LABEL maintainer=cn_yeyeck ADD jdk-8u231-linux-x64.tar.gz /usr/local ENV JAVA_HOME /usr/local/jdk1.8.0_231 ENV JRE_HOME /usr/local/jdk1.8.0_231/jre ENV PATH $JAVA_HOME/bin:$JRE_HOME/bin:$PATH #################################
4. Construction of a new command execution docker build container
# Do not forget to have a back. Build Docker -t centos7-jdk8: 1 .
# wait on a command finishes, check the list of containers whether there centos7-jdk8: 1, after the colon is the tag, equivalent to Version
Docker ImagesRF Royalty Free
5. Enter centos7-jdk8: 1, and checks whether there java environment
docker run -it centos7-jdk8:1
After you do docker run -it centos7-jdk8: After 1, entered the centos7-jdk8: 1 command line directly execute java -version check whether the environment with good java