In the previous article "Dockerfile Introduction and Common Reserved Instructions" , we introduced what Dockerfile is and the commonly used reserved fields of Dockerfile. After getting familiar with these, do you want to write a Dockerfile by yourself? In this article, we will actually fight our own Dockerfile.
Case requirements:
We use the centos of the remote warehouse as a template to create a mirror image that substitutes vim\ifconfig\java8
jdk mirror address: Index of /jdk/
Steps: write, build, run
write:
Prepare to write Dockerfile. NOTE: The letter D needs to be capitalized.
Create folder: myfile
Then copy the downloaded jdk-8u171-linux-x64.tar.gz to the myfile folder
Write Dockerfile:
vim Dockerfile
Copy the following:
FROM centos:7 MAINTAINER kaigejava ENV MYPATH /usr/local WORKDIR $MYPATH #Install vim editor RUN yum -y install vim #Install ifconfig command to view network IP RUN yum -y install net-tools #Install java8 and l