Docker commit mode mirror production
1.docker commit
-
Pull a mirror
docker pull centos
-
Create a container
docker run -it --name=mycentos centos /bin/bash
-
Copy the files to be installed on the server to the container outside the container in the new window
docker cp 文件路径 容器名:/目录
4. Unzip the file c to uppercase
tar -zxvf jdk-8u231-linux-x64.tar.gz -C /usr/local/
5. Configure environment variables
vi /etc/profile
Insert at the end of the file
JAVA_HOME=/usr/local/jdk1.8.0_231
export PATH=$JAVA_HOME/bin:$PATH
-
Update file
source /etc/profile
-
View
java -version
-
Refer to the above to decompress tomcat to
/usr/local
-
Configure environment variables in tomcat
vi /usr/local/apache-tomcat-8.5.57/bin/setclasspath.sh
Add to
export JAVA_HOME=/usr/local/jdk1.8.0_231
export JRE_HOME=/usr/local/jdk1.8.0_231/jre
10. Submit the image and
execute in a new window outside the container:
docker commit mycentos mytomcat
-
View mirror
docker images
-
Create a container based on the new image file
docker run -itd --name=t1 -p 8888:8080 mytomcat /bin/bash
-p means port mapping, map 8080 to 8888 for access
-
Start the container
docker exec t1 /usr/local/apache-tomcat-8.5.57/bin/startup.sh
-
Enter URL verification:
2.docker builder 和 Dockerfile
There is another way for docker builder and Dockerfile, which will be added later