5-docker docker learning environment tomcat install and deploy war package

Download tomcat Mirror

[root@bogon data]# docker pull tomcat
Using default tag: latest
latest: Pulling from library/tomcat
9cc2ad81d40d: Pulling fs layer
e6cb98e32a52: Pulling fs layer
ae1b8d879bad: Downloading
42cfa3699b05: Waiting
8d27062ef0ea: Waiting
9b91647396e3: Waiting
7498c1055ea3: Waiting
a183d8c2c929: Waiting
73dd800dda4c: Waiting
2bc71ef979ec: Waiting
latest: Pulling from library/tomcat
9cc2ad81d40d: Pull complete
e6cb98e32a52: Pull complete
ae1b8d879bad: Pull complete
42cfa3699b05: Pull complete
8d27062ef0ea: Pull complete
9b91647396e3: Pull complete
7498c1055ea3: Pull complete
a183d8c2c929: Pull complete
73dd800dda4c: Pull complete
2bc71ef979ec: Pull complete
Digest: sha256:80db17f3efd9cdcd9af7c799097fe0d223bbee8f25aa36234ab56292e3d8bd7b
Status: Downloaded newer image for tomcat:latest
docker.io/library/tomcat:latest
[root@bogon data]#

Run container

Use docker run run a tomcat container

  • --name yoyotomcat container heavy naming yoyotomcat
  • -p 8090: 8080 is mapped to the host port 8080 of container 8090 port
  • -v ~ / yoyo / tomcat / webapps / jenkins: / usr / local / tomcat / webapps / jenkins container / usr / local / tomcat / webapps / jenkins directory is mounted to the machine ~ / yoyo / tomcat / webapps / jenkins
  • -d hanging background

[root@bogon webapps]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8f99aa298cc8 tomcat "catalina.sh run" 59 seconds ago Up 57 seconds 0.0.0.0:8089->8080/tcp leslietomcat
4252c716b85d mysql:5.7 "docker-entrypoint.s…" 2 hours ago Up 2 hours 33060/tcp, 0.0.0.0:3309->3306/tcp lesliemysql
[root@bogon webapps]#

In this way the browser to http: // host ip: 8090 can access the home page to tomcat

 

 

Deploy war package

Because there are self-Jenkins, it is time to start mapping installation directory

[root@bogon /]# docker run --name leslietomcat -p 8089:8080 -v /opt/shaobo/apache-tomcat-9.0.20/webapps:/usr/local/tomcat/webapps -d tomcat

 

Guess you like

Origin www.cnblogs.com/leslie003/p/11454825.html
Recommended