Docker installation and mirroring with springboot jar

1. The first is to install centos7

2. Recommended reference for installing docker

https://www.jianshu.com/p/ef14131fe900

2.1 docker some commonly used commands

docker ps view container

docker run create container

docker rmi imageId delete container

docker images list index images

 Description of each option:

    REPOSITORY: indicates the source of the mirrored warehouse

     TAG: Mirrored tag

     IMAGE ID: Image ID

     CREATED: Mirror creation time

     SIZE: mirror size

      The same warehouse source can have multiple TAGs, representing different versions of the warehouse source. We use REPOSITORY:TAG to define different mirrors.

 

3. The specific process of springboot as a mirror

3.1. Compile and generate the image (. means the current directory) imageName is set to the name of the image you define

 docker build -t  imageName .

3.2. Create a container and start

Explain here: Docker container is a runnable instance of the image (the relationship between the image and the container is actually similar to the class and object in Java)
docker run -d -p 8080:8080 imageName 

[root@localhost docker]# docker run -d -p 8080:9180 -v /home/work/dockerFile-volte:/tmp      imageName 

The -d parameter is to let the container run in the background 
-p is to do port mapping, at this time, map the 8080 port in the server to the 8085 in the container (the port configuration in the project is 8085) port
-v Mount the directory

With the -v parameter, the host directory before the colon must be an absolute path, and the path after the colon is the path mounted in the mirror.

3.3 tar the container 

Then the save parameter is packaged in the format: docker save -o to type the name of the image package mirror
docker save -o project_test.tar imageName

docker save -o project_test.tar REPOSITORY:TAG

3.4 Then transfer the package to another server for deployment or upgrade

First carry out load to export the image operation load: import  the image exported using the  docker save command.

   docker load -i project_test.tar

Then check if there is a mirror

   docker images

Then label the image you just imported, the purpose is to put the image you just imported into a certain mirror warehouse (the so-called warehouse is: docker.oa.com:8080/tmf/ and then add the name of the image you want to use :version number)

docker tag  project_test:v20191123     docker.oa.com:8080/tmf/project_test:v20191123

Then push the mirror image to the warehouse

docker push  docker.oa.com:8080/tmf/project_test:v20191123

Reference: https://www.cnblogs.com/Dfengshuo/p/12067190.html

         https://blog.csdn.net/weixin_37773766/article/details/80702926

 

 

Guess you like

Origin blog.csdn.net/JHON07/article/details/103643851