Docker commit mode mirror production

Docker commit mode mirror production

1.docker commit

  1. Pull a mirror
    docker pull centos

  2. Create a container
    docker run -it --name=mycentos centos /bin/bash

  3. Copy the files to be installed on the server to the container outside the container in the new window
    Insert picture description here

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 picture description here
Insert at the end of the file

JAVA_HOME=/usr/local/jdk1.8.0_231
export PATH=$JAVA_HOME/bin:$PATH

Insert picture description here

  1. Update file
    source /etc/profile

  2. View
    java -version
    Insert picture description here

  3. Refer to the above to decompress tomcat to/usr/local
    Insert picture description here

  4. 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

Insert picture description here
10. Submit the image and
execute in a new window outside the container:
docker commit mycentos mytomcat
Insert picture description here
Insert picture description here

  1. View mirror
    docker images
    Insert picture description here

  2. 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
    Insert picture description here

  3. Start the container
    docker exec t1 /usr/local/apache-tomcat-8.5.57/bin/startup.sh
    Insert picture description here

  4. Enter URL verification:
    Insert picture description here

2.docker builder 和 Dockerfile

There is another way for docker builder and Dockerfile, which will be added later

Guess you like

Origin blog.csdn.net/Guesshat/article/details/109404560