[root@m01 myjavaweb]# cat Dockerfile
FROM tomcat:7.0.88-jre8
MAINTAINER paul
ENV TOMCAT_BASE /usr/local/tomcat
COPY ./firstweb_war.war $TOMCAT_BASE/webapps
[root@m01 myjavaweb]#
[root@m01 myjavaweb]# docker build -t myjavaweb .
Sending build context to Docker daemon 3.584kB
Step 1/4 : FROM tomcat:7.0.88-jre8
7.0.88-jre8: Pulling from library/tomcat
0bd44ff9c2cf: Pull complete
047670ddbd2a: Pull complete
ea7d5dc89438: Pull complete
4a05570971bb: Pull complete
66f679cd5859: Pull complete
89362eaac850: Pull complete
d76c23323cb4: Pull complete
f7a113d2d566: Pull complete
f7ffd00be2be: Pull complete
dd678d267c76: Pull complete
572bf4dd0e62: Pull complete
60f62eada405: Pull complete
Digest: sha256:4755237ae455bc4fe4faaa51e62279d6984df7141ace279a17b4d6061f5fefe0
Status: Downloaded newer image for tomcat:7.0.88-jre8
---> 5ad66ba6af12
Step 2/4 : MAINTAINER paul
---> Running in 9747a5df514c
Removing intermediate container 9747a5df514c
---> 3da6fbf7215e
Step 3/4 : ENV TOMCAT_BASE /usr/local/tomcat
---> Running in f9177e819a57
Removing intermediate container f9177e819a57
---> 1511aaeaea11
Step 4/4 : COPY ./firstweb_war.war $TOMCAT_BASE/webapps
---> 46ade77f7ed5
Successfully built 46ade77f7ed5
Successfully tagged myjavaweb:latest
[root@m01 myjavaweb]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
myjavaweb latest 46ade77f7ed5 15 seconds ago 463MB
xcnginx latest 9de587696f52 About an hour ago 109MB
nginx latest 27a188018e18 11 days ago 109MB
tomcat 7.0.88-jre8 5ad66ba6af12 10 months ago 463MB
[root@m01 myjavaweb]# docker run --name myjavaweb -d -p 8080:8080 myjavaweb
49ec914c9f71c2caaea3d0addad74d83428973fabb132ba6aed1e4dba525635b
[root@m01 myjavaweb]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
49ec914c9f71 myjavaweb "catalina.sh run" 6 seconds ago Up 4 seconds 0.0.0.0:8080->8080/tcp myjavaweb
679bb11f2625 xcnginx "nginx -g 'daemon of…" About an hour ago Up About an hour 0.0.0.0:80->80/tcp xcnginx
[root@m01 myjavaweb]# docker exec -it myjavaweb bash
root@49ec914c9f71:/usr/local/tomcat# ls
LICENSE NOTICE RELEASE-NOTES RUNNING.txt bin conf include lib logs native-jni-lib temp webapps work
root@49ec914c9f71:/usr/local/tomcat# cd /usr/local/tomcat/
root@49ec914c9f71:/usr/local/tomcat# ls -l
total 128
-rw-r--r-- 1 root root 56846 May 7 2018 LICENSE
-rw-r--r-- 1 root root 1239 May 7 2018 NOTICE
-rw-r--r-- 1 root root 9363 May 7 2018 RELEASE-NOTES
-rw-r--r-- 1 root root 16962 May 7 2018 RUNNING.txt
drwxr-xr-x 2 root root 4096 Jun 27 2018 bin
drwxr-xr-x 1 root root 4096 Apr 28 00:07 conf
drwxr-sr-x 3 root staff 4096 Jun 27 2018 include
drwxr-xr-x 2 root root 4096 Jun 27 2018 lib
drwxr-xr-x 1 root root 4096 Apr 28 00:07 logs
drwxr-sr-x 3 root staff 4096 Jun 27 2018 native-jni-lib
drwxr-xr-x 2 root root 4096 Jun 27 2018 temp
drwxr-xr-x 1 root root 4096 Apr 28 00:07 webapps
drwxr-xr-x 1 root root 4096 Apr 28 00:07 work
root@49ec914c9f71:/usr/local/tomcat# cd webapps/
root@49ec914c9f71:/usr/local/tomcat/webapps# ls -l
total 28
drwxr-xr-x 3 root root 4096 Jun 27 2018 ROOT
drwxr-xr-x 14 root root 4096 Jun 27 2018 docs
drwxr-xr-x 7 root root 4096 Jun 27 2018 examples
drwxr-xr-x 3 root root 4096 Apr 28 00:07 firstweb_war
-rw-r--r-- 1 root root 782 Apr 28 00:00 firstweb_war.war
drwxr-xr-x 5 root root 4096 Jun 27 2018 host-manager
drwxr-xr-x 5 root root 4096 Jun 27 2018 manager
root@49ec914c9f71:/usr/local/tomcat/webapps# exit
exit
[root@m01 myjavaweb]# netstat -pan|grep 8080
tcp6 0 0 :::8080 :::* LISTEN 5773/docker-proxy