Use docker deploy tomcat | tomcat The second base use

Use docker deploy tomcat | tomcat The second base use

1. review

  1. tomcat server learn: https://www.cnblogs.com/jiading/p/11974935.html
  2. docker learning: https://www.cnblogs.com/jiading/p/12131441.html

2. tomcat supplement use

  1. Where is the file location in tomcat server

    Today, suddenly found previously configured tomcat actually random start, which means it has been quietly running 2333, but fortunately little memory footprint. However, this advantage also from the side of the docker use: the packaged applications, it is true, once closed off, and will not have any effect on the machine

    anyway, accessing localhost: 8080, in the tomcat welcome page can be queried to its location in / var / lib / tomcat9 /

  2. What in the webapps ROOT project is

    ROOT project is enabled by default tomcat project, which is the input <域名>:<端口号>item default access, of course, be deleted, then press the delete <域名>:<端口号>input will not show up (if it is a direct war with the deployment package deployment without using server.xml way words)

  3. How to access the project using the war package deployment

    <域名>:<端口号>/<项目路径名>

3. Use docker deploy tomcat

Because it is the first independent use docker, or bend around some of

  1. Pulling tomcat image:docker pull tomcat

  2. Run container:docker run -d --name tomcatfortravel -p 8081:8080 -v /home/jiading/Desktop/travelWeb:/usr/local/tomcat/webapps -v /home/jiading/Desktop/travelLog:/usr/local/tomcat/logs tomcat

    Let me explain the parameters:

    1. run: Run containers
    2. -d: in order to protect the formula way to start (that is running in the background) and certainly not have to run in daemon mode, you can run interactively -it foreground, but rather special tomcat is run automatically after you start the tomcat service, shell Yes. is occupied, so -it is also running in the foreground can not interact in the shell (if required interaction, it can re-enter after running -d background docker exec <容器ID> /bin/bash)
    3. -p: port mapping, local computer if you are not running tomcat and other server software and you only intend to open a docker container, then you can not add
    4. -v: data volume, this path is my computer, so you can not directly copy run the above command . The benefits of doing so is that I can look directly run logs 1. 2. Under the war package into a folder on the desktop travelWeb can be automatically deployed in the container, easy to operate

    Here it must be noted, Docker RUN command, write the name of the mirror after all the parameters (like I did in the above), or it may be an error, for example,starting container process caused "exec: \"-d\": executable file not found in $PATH": unknown.

  3. After the war package copied to the local data volume mapping file folders above, can be entered on the local browser localhost:8081/<项目名>run a web project

Docker benefit is the ability to use multiple containers to simulate multiple servers

Guess you like

Origin www.cnblogs.com/jiading/p/12153123.html