1,docker 下载tomcat

[root@it-1c2d ~]# docker pull tomcat-1c2d ~]# docker images4


2,docker安装


[root@it-1c2d webnav]# docker run --name tomcat -p 8081:8080d tomcat-1c2d webnav]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
311dcda23832 tomcat "catalina.sh run" 15 seconds ago Up 14 seconds 0.0.0.0:8081->8080/tcp, :::8081->8080/tcp tomcat
e6b306df750b nginx "/docker-entrypoint.…" 6 weeks ago Up 6 weeks 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp nginx
04b2dde69bbe wiki0829 "docker-entrypoint.s…" 6 weeks ago Up 6 weeks 3443/tcp, 0.0.0.0:8080->3000/tcp, :::8080->3000/tcp wiki
fdfc369cacfa mysql:latest "docker-entrypoint.s…" 5 months ago Up 6 weeks 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp


其中:用 -v 指令指定把容器中的某个文件夹挂载到宿主机中
它的语法为:  ​​​-v 宿主机目录:容器目录​

-d: 后台运行容器,并返回容器ID​