1. View the image on docker
[root@holly ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.6 73829d7b6139 4 weeks ago 256MB
2. Search tomcat mirrored on the docker
[root@holly ~]# docker search tomcat
3. Download tomcat, if not the pull command with a version number, then download the latest version
[root@holly ~]# docker pull tomcat
4. Re-View Mirror
[root@holly ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
tomcat latest 1c721f25f939 3 days ago 522MB
mysql 5.6 73829d7b6139 4 weeks ago 256MB
[root@holly ~]#
5, the container generates tomcat
[root@holly ~]# docker run -d -p 8080:8080 --name tomcat-test tomcat
52c027153e231f386e3940eb1a0aa46e1cf31fa10f00404232beb535e0f41081
docker run 将镜像 生成为容器
-p 容器端口号:宿主机端口号
6.在宿主机上访问tomat,看下是否能够访问,看到如下界面表示容器已经构建成功