1、搜索镜像
$ docker search tomcat
2、下载镜像
$ docker pull tomcat
3、查看本地镜像
$ docker images
4、从镜像启动一个容器
$ docker run -itd --name tomcat01 -p 8010:8080 tomcat
# 测试服务是否成功
$ curl localhost:8010
<!doctype html><html lang="en"><head><title>HTTP Status 404 – Not Found</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 404 – Not Found</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Description</b> The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.</p><hr class="line" /><h3>Apache Tomcat/10.0.14</h3></body></html>
5、进入容器
$ docker exec -it tomcat01 /bin/bash
root@8e93edcb72c6:/usr/local/tomcat# cp -r webapps.dist/* webapps