Docker tomcat installation directory to mounting the host vessel and

Docker install tomcat

  1. Search tomcat Mirror

    docker search tomcat
  2. It tomcat pulls the latest official image

    docker pull tomcat
  3. Create a container tomcat-test, the host of the 8080 port mapping to tomcat 8080 port

    docker run --name tomcat-test -d -p 8080:8080 tomcat
  4. Browser to open the input ip + 8080

Host directory to mount the container

  1. tomcat webapps container path: / usr / local / tomcat / webapps
  2. In the home directory new directory / home / ubuntu / tomcat / webapps
  3. Stop tomcat container and remove the container
    1. Find a container CONTAINER ID

      docker ps -a 
    2. Stop the container

       docker stop CONTAINER_ID
    3. Delete container

      docker rm CONTAINER_ID 
  4. Re-run a tomcat container home directory and mount

    docker run --name tomcat-service -d -p 8080:8080 -v /home/ubuntu/tomcat/webapps:/usr/local/tomcat/webapps tomcat  

Guess you like

Origin www.cnblogs.com/liyiran/p/12544715.html