一、Docker简介
1.官网
Docker官网: Docker文档地址:https://docs.docker.com/ Docker仓库地址:https://hub.docker.com/
2.传统虚拟机与容器的比较
传统的虚拟机包含一套完整的计算机结构,而容器只保存必要的环境,以确保最小的轻量化
(1)docker抽象层比虚拟机少
由于docker不需要Hypervisor(虚拟机)实现硬件资源的虚拟化,在硬件资源中运行docker实际物理机的硬件资源直接用于容器上的程序。CPU、内存利用率docker在效率势明显。
(2)docker无需加载操作系统,使用宿主机的内核OS内核
新建容器时,docker操作系统内核不需要像虚拟机一样重新加载。然后避免引入、加载操作系统内核返回等费时费力的过程。新建虚拟机时,需要加载虚拟机软件OS,返回新建过程是分钟级的。而docker由于宿主机的操作系统直接使用,返回过程被省略,因此新建了一个docker容器只需要几秒钟。
3.Docker三要素
镜像(image) | Docker 镜像(Image)就是一个模板。镜像可用于创建 Docker 一个镜像可以创建许多容器。 |
---|---|
容器(container) | 容器是由镜像创建的操作实例 |
仓库(repository) | 仓库(Repository)镜像文件集中存储的地方 |
当我们启动镜像文件时,我们会经历以下判断
4.Docker平台架构图解
Docker 是一个 C/S 模式架构,后端是松耦合架构,许多模块履行自己的职责
二、Docker安装
1.安装步骤
Centos7安装Docker官方网站地址: https://docs.docker.com/engine/install/centos/
0 安装基本环境 yum -y install gcc yum -y install gcc-c 1 安装软件库 yum install -y yum-utils 2 设置稳定的仓库 (国外仓库)yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo (阿里云仓库)yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo 3 更新yml软件包索引 (不推荐官网,自己配置的) yum makecache fast 4 安装Docker引擎(可能有点慢) yum install -y docker-ce docker-ce-cli containerd.io
5 安装完成之后查看版本
docker version
6 启动
systemctl start docker
2.配置阿里云镜像加速
1 创建配置文件目录
mkdir -p /etc/docker
2 配置压缩地址(将内容写入到文件中)
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://bc0ogk7n.mirror.aliyuncs.com"]
}
EOF
3 重新加载配置文件
systemctl daemon-reload
4 重启docker
systemctl restart docker
docker info
三、Docker基本命令
1.帮助启动命令
命令 | 信息 |
---|---|
docker version | 查看版本 |
docker info | 查看docker具体信息 |
docker --help | 总体帮助文档 |
docker 具体命令 --help | 命令帮助文档 |
systemctl start docker | 启动docker |
systemctl stop docker | 停止docker |
systemctl restart docker | 重启docker |
systemctl status docker | 查看docker状态 |
systemctl enable docker | 开机启动 |
2.镜像命令
1)查看本地镜像 docker images 查询结果表格字段:镜像仓库源(REPOSITORY)、
标签版本号(TAG)、镜像ID(IMAGE ID)、镜像创建时间(CREATED)、镜像大小(SIZE) -a: 列出本地所有的镜像(含中间映像层) -q: 只显示镜像Id --digests :显示镜像的摘要信息 --no-trunc :显示完整的镜像信息 2)搜索镜像 docker search 镜像名 查询结果表格字段:镜像名称(NAME)、镜像说明(DESCRIPTION)、点赞数量(STARS)、是否官网(OFFICIAL)、是否自动构建(AUTOMATED) --no-trunc : 显示完整的镜像描述 --limit 只列出N个镜像,默认25个 -s : 列出收藏数不小于指定值的镜像。 --automated : 只列出 automated build类型的镜像; 3)镜像下载 docker pull 镜像名[:TAG] 没有TAG就是最新版,等价于docker pull 镜像名称:latest 4)镜像删除 docker rmi 删除一个: docker rmi -f 镜像ID 删除多个: docker rmi -f 镜像名1:TAG 镜像名2:TAG 删除全部: docker rmi -f $(docker images -qa) 5)查看镜像/容器/数据卷所占的空间 docker system df
3.容器命令
1)新建并启动容器
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
OPTIONS说明(常用):有些是一个减号,有些是两个减号
--name="容器新名字": 为容器指定一个名称;
-d: 后台运行容器,并返回容器ID,也即启动守护式容器;
-i:以交互(interavtive)模式运行容器,通常与 -t 同时使用;
-t:为容器重新分配一个伪输入终端,通常与 -i 同时使用;
-P: 随机端口映射;
-p: 指定端口映射,有以下四种格式
ip:hostPort:containerPort
ip::containerPort
【前台交互式启动】docker run -it 容器
【后台守护式启动】docker run -d 容器
2)查看正在运行的容器
docker ps [OPTIONS]
OPTIONS说明(常用):
-a :列出当前所有正在运行的容器+历史上运行过的
-l :显示最近创建的容器。
-n:显示最近n个创建的容器。
-q :静默模式,只显示容器编号。
3)退出容器
exit 容器停止并退出
ctrl+P+Q 容器不停止退出
4)进入正在运行的容器并以命令行交互
docker exec -it 容器ID /bin/bash 【推荐】 (exec 是在容器中打开新的终端,并且可以启动新的进程,用exit退出,不会导致容器的停止)
docker attach 容器ID (attach 直接进入容器启动命令的终端,不会启动新的进程,用exit退出,会导致容器的停止)
5)启动已停止运行的容器
docker start 容器ID/容器名
6)重启重启
docker restart 容器ID/容器名
7)停止容器
docker stop 容器ID/容器名
8)强制停止容器
docker kill 容器ID/容器名
9)删除已停止的容器
删除一个: docker rm 容器ID
删除多个: docker rm -f $(docker ps -a -q)
10)查看容器日志
docker logs [OPTIONS] 容器ID
-t 是加入时间戳
-f 跟随最新的日志打印
--tail 数字 显示最后多少条
[常用]docker logs -f -t --tail 容器ID
11)查看容器内运行的进程
docker top 容器ID
12)查看容器内部细节
docker inspect 容器ID
13)从容器内拷贝文件到主机上
docker cp 容器ID:容器内路径 目的主机路径
14)导入和导出容器
导出: docker export 容器ID > 文件名.tar
导入: cat 文件名.tar | docker import - 镜像用户/镜像名:镜像版本号
4.容器命令 help命令查看
attach Attach to a running container # 当前 shell 下 attach 连接指定运行镜像
build Build an image from a Dockerfile # 通过 Dockerfile 定制镜像
commit Create a new image from a container changes # 提交当前容器为新的镜像
cp Copy files/folders from the containers filesystem to the host path #从容器中拷贝指定文件或者目录到宿主机中
create Create a new container # 创建一个新的容器,同 run,但不启动容器
diff Inspect changes on a container's filesystem # 查看 docker 容器变化
events Get real time events from the server # 从 docker 服务获取容器实时事件
exec Run a command in an existing container # 在已存在的容器上运行命令
export Stream the contents of a container as a tar archive # 导出容器的内容流作为一个 tar 归档文件[对应 import ]
history Show the history of an image # 展示一个镜像形成历史
images List images # 列出系统当前镜像
import Create a new filesystem image from the contents of a tarball # 从tar包中的内容创建一个新的文件系统映像[对应export]
info Display system-wide information # 显示系统相关信息
inspect Return low-level information on a container # 查看容器详细信息
kill Kill a running container # kill 指定 docker 容器
load Load an image from a tar archive # 从一个 tar 包中加载一个镜像[对应 save]
login Register or Login to the docker registry server # 注册或者登陆一个 docker 源服务器
logout Log out from a Docker registry server # 从当前 Docker registry 退出
logs Fetch the logs of a container # 输出当前容器日志信息
port Lookup the public-facing port which is NAT-ed to PRIVATE_PORT # 查看映射端口对应的容器内部源端口
pause Pause all processes within a container # 暂停容器
ps List containers # 列出容器列表
pull Pull an image or a repository from the docker registry server # 从docker镜像源服务器拉取指定镜像或者库镜像
push Push an image or a repository to the docker registry server # 推送指定镜像或者库镜像至docker源服务器
restart Restart a running container # 重启运行的容器
rm Remove one or more containers # 移除一个或者多个容器
rmi Remove one or more images # 移除一个或多个镜像[无容器使用该镜像才可删除,否则需删除相关容器才可继续或 -f 强制删除]
run Run a command in a new container # 创建一个新的容器并运行一个命令
save Save an image to a tar archive # 保存一个镜像为一个 tar 包[对应 load]
search Search for an image on the Docker Hub # 在 docker hub 中搜索镜像
start Start a stopped containers # 启动容器
stop Stop a running containers # 停止容器
tag Tag an image into a repository # 给源中镜像打标签
top Lookup the running processes of a container # 查看容器中运行的进程信息
unpause Unpause a paused container # 取消暂停容器
version Show the docker version information # 查看 docker 版本号
wait Block until a container stops, then print its exit code # 截取容器停止时的退出状态值
四、Docker镜像
镜像是一种轻量级、可执行的独立软件包,它包含运行某个软件所需的所有内容,我们把应用程序和配置依赖打包好形成一个可交付的运行环境(包括代码、运行时需要的库、环境变量和配置文件等),这个打包好的运行环境就是image镜像文件。
1.Docker镜像分层
当我们通过pull拉取镜像,在下载的过程中我们可以看到docker的镜像好像是在一层一层的下载,这就是镜像分层,它在底层使用了联合文件系统(UnionFS)
Docker中的镜像分层,支持通过扩展现有镜像,创建新的镜像。类似Java继承于一个Base基础类,自己再按需扩展。新镜像是从 base 镜像一层一层叠加生成的。每安装一个软件,就在现有镜像的基础上增加一层
2.UnionFS联合文件系统
UnionFS(联合文件系统):Union文件系统(UnionFS)是一种分层、轻量级并且高性能的文件系统,它支持对文件系统的修改作为一次提交来一层层的叠加
,同时可以将不同目录挂载到同一个虚拟文件系统下(unite several directories into a single virtual filesystem)。Union 文件系统是 Docker 镜像的基础。镜像可以通过分层来进行继承
,基于基础镜像(没有父镜像),可以制作各种具体的应用镜像。
特性
:一次同时加载多个文件系统,但从外面看起来,只能看到一个文件系统,联合加载会把各层文件系统叠加起来,这样最终的文件系统会包含所有底层的文件和目录,好处肯定就是复用
3.Docker镜像加载原理
docker的镜像实际上由一层一层的文件系统组成,这种层级的文件系统UnionFS。
bootfs(boot file system)主要包含bootloader和kernel, bootloader主要是引导加载kernel, Linux刚启动时会加载bootfs文件系统,在Docker镜像的最底层是引导文件系统bootfs
。这一层与我们典型的Linux/Unix系统是一样的,包含boot加载器和内核。当boot加载完成之后整个内核就都在内存中了,此时内存的使用权已由bootfs转交给内核,此时系统也会卸载bootfs。
rootfs (root file system) ,在bootfs之上。包含的就是典型 Linux 系统中的 /dev, /proc, /bin, /etc 等标准目录和文件。rootfs就是各种不同的操作系统发行版,比如Ubuntu,Centos等等。
Docker镜像层都是只读的,容器层是可写的,当容器启动时,一个新的可写层被加载到镜像的顶部。这一层通常被称作“容器层”,“容器层”之下的都叫“镜像层” 所有对容器的改动 - 无论添加、删除、还是修改文件都只会发生在容器层中。只有容器层是可写的,容器层下面的所有镜像层都是只读的。
五、本地镜像发布到阿里云
1.流程
2.镜像的生成方法
(1)通过commit创建一个新的镜像
docker commit 提交容器副本使之成为一个新的镜像
docker commit -m="提交的描述信息" -a="作者" 容器ID 要创建的目标镜像名:[标签名]
(2)通过DockerFile
3.push到阿里云
1)
选择控制台,进入容器镜像服务
2)
3)
4)
5)
阿里云会提供对应的操作指南
(6)
// 登陆阿里云Docker仓库
[root@localhost docker]# docker login --username=王佳林酱 registry.cn-hangzhou.aliyuncs.com
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json. Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
// 查看镜像
[root@localhost docker]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
redis latest 7614ae9453d1 3 months ago 113MB
// docker tag重命名镜像
[root@localhost docker]# docker tag 7614ae9453d1 registry.cn-hangzhou.aliyuncs.com/wangjialin/jianan:1.1
// 推送
[root@localhost docker]# docker push registry.cn-hangzhou.aliyuncs.com/wangjialin/jianan:1.1
The push refers to repository [registry.cn-hangzhou.aliyuncs.com/wangjialin/jianan]
8e5669d83291: Pushed
9975392591f2: Pushed
529cdb636f61: Pushed
4b8e2801e0f9: Pushed
9b24afeb7c2f: Pushed
2edcec3590a4: Pushed
1.1: digest: sha256:563888f63149e3959860264a1202ef9a644f44ed6c24d5c7392f9e2262bd3553 size: 1573
4.pull阿里云镜像
上面我们将镜像发布到了阿里云上面,这里面尝试拉取,那么拉取的命令在操作指南里面已经提供了
// 从阿里云提供的操作指南上复制即可
$ docker pull registry.cn-hangzhou.aliyuncs.com/wangjialin/jianan:[镜像版本号]
六、本地私有镜像库
1.官方Docker Hub地址:https://hub.docker.com/,中国大陆访问太慢了且准备被阿里云取代的趋势,不太主流。 2.Dockerhub、阿里云这样的公共镜像仓库可能不太方便,涉及机密的公司不可能提供镜像给公网,所以需要创建一个本地私人仓库供给团队使用,基于公司内部项目构建镜像。 Docker Registry是官方提供的工具,可以用于构建私有镜像仓库
1.搭建步骤
[root@localhost docker]# docker pull registry
Using default tag: latest
latest: Pulling from library/registry
79e9f2f55bf5: Pull complete
0d96da54f60b: Pull complete
5b27040df4a2: Pull complete
e2ead8259a04: Pull complete
3790aef225b9: Pull complete
Digest: sha256:169211e20e2f2d5d115674681eb79d21a217b296b43374b8e39f97fcf866b375
Status: Downloaded newer image for registry:latest
docker.io/library/registry:latest
[root@localhost docker]# docker run -d -p 5000:5000 --privileged=true registry
d19d2ef935fa74c06e0118c2690f75c124f482ed6000ae709dc4e950be7a1883
[root@localhost docker]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d19d2ef935fa registry "/entrypoint.sh /etc…" 48 seconds ago Up 47 seconds 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp vigilant_ptolemy
1)创建一个新镜像,拉取ubuntu镜像,安装ifconfig命令
[root@localhost docker]# docker pull ubuntu
Using default tag: latest
latest: Pulling from library/ubuntu
7b1a6ab2e44d: Pull complete
Digest: sha256:626ffe58f6e7566e00254b638eb7e0f3b11d4da9675088f4781a50ae288f3322
Status: Downloaded newer image for ubuntu:latest
docker.io/library/ubuntu:latest
[root@localhost docker]# docker run -it ubuntu /bin/bash
root@c55e49d5fb93:/# ifconfig
bash: ifconfig: command not found
root@c55e49d5fb93:/# apt-get update
.....
root@c55e49d5fb93:/# apt-get install net-tools
....
root@c55e49d5fb93:/# ifconfig
2)commit镜像
// 查看正常运行的容器
[root@localhost docker]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c55e49d5fb93 ubuntu "/bin/bash" 7 minutes ago Up 7 minutes relaxed_black
d19d2ef935fa registry "/entrypoint.sh /etc…" 12 minutes ago Up 12 minutes 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp vigilant_ptolemy
// 将上面创建的案例镜像commit
[root@localhost docker]# docker commit -m="ifconfig cmd add" -a="jialin" c55e49d5fb93 myubuntu:1.1
sha256:3a71a171f302f318565d7a93504dffed1bd12afceb6ce3c6ee2ee27e3553db52
// 查看结果
[root@localhost docker]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
myubuntu 1.1 3a71a171f302 4 seconds ago 109MB
registry latest b8604a3fe854 4 months ago 26.2MB
ubuntu latest ba6acccedd29 5 months ago 72.8MB
通过HTTP请求验证私服仓库没有任何镜像
[root@localhost docker]# curl -XGET http://192.168.146.144:5000/v2/_catalog
{
"repositories":[]}
使用命令 docker tag 将镜像修改为私服库的镜像,然后推送进去
公式: docker tag 镜像:Tag Host:Port/Repository:Tag
[root@localhost docker]# docker tag myubuntu:1.1 192.168.146.144:5000/myubuntu:1.1
[root@localhost docker]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
192.168.146.144:5000/myubuntu 1.1 3a71a171f302 11 minutes ago 109MB
myubuntu 1.1 3a71a171f302 11 minutes ago 109MB
registry latest b8604a3fe854 4 months ago 26.2MB
ubuntu latest ba6acccedd29 5 months ago 72.8MB
修改 /etc/docker/daemon.json
,添加新内容"insecure-registries": ["192.168.146.144:5000"]
,注意IP为自己的
// 先查看一下
[root@localhost docker]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://bc0ogk7n.mirror.aliyuncs.com"]
}
// 修改内容
[root@localhost docker]# vi /etc/docker/daemon.json
// 重启docker
[root@localhost docker]# systemctl restart docker
// 重启Docker以后记得启动registry仓库
[root@localhost docker]# docker start d19d2ef935fa
// 再次查看
[root@localhost docker]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://bc0ogk7n.mirror.aliyuncs.com"],
"insecure-registries": ["192.168.146.144:5000"]
}
[root@localhost docker]# docker push 192.168.146.144:5000/myubuntu:1.1
The push refers to repository [192.168.146.144:5000/myubuntu]
e4167fdc22fe: Pushed
9f54eef41275: Pushed
1.1: digest: sha256:4b4f60661571772a940dae8b54689f7cf597fbaa65c357d41f15c6187e0e572f size: 741
[root@localhost docker]# curl -XGET http://192.168.146.144:5000/v2/_catalog
{
"repositories":["myubuntu"]}
[root@localhost docker]# docker pull 192.168.146.144:5000/myubuntu:1.1
1.1: Pulling from myubuntu
7b1a6ab2e44d: Already exists
1c3c8666f09e: Pull complete
Digest: sha256:4b4f60661571772a940dae8b54689f7cf597fbaa65c357d41f15c6187e0e572f
Status: Downloaded newer image for 192.168.146.144:5000/myubuntu:1.1
192.168.146.144:5000/myubuntu:1.1
[root@localhost docker]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
192.168.146.144:5000/myubuntu 1.1 3a71a171f302 About an hour ago 109MB
registry latest b8604a3fe854 4 months ago 26.2MB
ubuntu latest ba6acccedd29 5 months ago 72.8MB
[root@localhost docker]# docker run -it 3a71a171f302
root@3cf959355ee1:/# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
...
七、Docker容器数据卷
1.简介
容器数据卷
就是将docker容器内的数据保存进宿主机的磁盘内
卷就是目录或文件,存在于一个或多个容器中,由docker挂载到容器,但不属于联合文件系统,因此能够绕过Union File System提供一些用于持续存储或共享数据的特性,卷的设计目的就是数据的持久化
,完全独立于容器的生存周期,因此Docker不会在容器删除时删除其挂载的数据卷
简单点说就是在容器外绑定了一个移动硬盘,当容器出问题时,硬盘内的数据是不会丢失的
2.命令
docker run -it --privileged=true -v /宿主机绝对路径目录:/容器内目录 [-v 可以挂载多个目录] 镜像名
--privileged=true用于扩大容器的权限,解决挂载目录没有权限的问题,也即使用该参数,container内的root拥有真正的root权限,否则,container内的root只是外部的一个普通用户权限
3.特点
- 数据卷可在容器之间共享或重用数据
- 卷中的更改可以直接实时生效,爽
- 数据卷中的更改不会包含在镜像的更新中
- 数据卷的生命周期一直持续到没有容器使用它为止
4.数据卷可以为读写/只读
默认宿主机目录和容器内目录是同步的,而且都可以读写,但是这个可以修改
【默认:读写】
docker run -it --privileged=true -v /宿主机绝对路径目录:/容器内目录:rw 镜像名
【只读】
docker run -it --privileged=true -v /宿主机绝对路径目录:/容器内目录:ro 镜像名
5.卷的继承和共享
当容器1和宿主机绑定了容器卷,那么容器2可以继承容器1的卷规则
关键命令:--volumes-from 父类
[root@localhost docker]# docker run -it --name myu3 --privileged=true --volumes-from 父类 镜像名 /bin/bash
6.案例
1)启动容器,添加数据卷
[root@localhost docker]# docker run -it --name myu3 --privileged=true -v /usr/local/docker/test1:/tmp/myDockerData ubuntu /bin/bash
root@432a25c18f9b:
2)查看挂载结果
[root@localhost docker]# docker inspect 432a25c18f9b
"Mounts": [
{
"Type": "bind",
"Source": "/usr/local/docker/test1",
"Destination": "/tmp/myDockerData",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
}
],
3)数据共享测试
当docker修改,主机同步获得 |
---|
当主机修改,docker同步获取 |
docker容器stop,此时修改主机的内容,容器重启以后,数据依然同步 |
// 宿主机内映射目录添加文件
[root@localhost test1]# pwd
/usr/local/docker/test1
[root@localhost test1]# touch a.txt
[root@localhost test1]# vi a.txt
[root@localhost test1]# cat a.txt
我在宿主机内添加的
[root@localhost test1]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
432a25c18f9b ubuntu "/bin/bash" 5 minutes ago Up 5 minutes myu3
3cf959355ee1 3a71a171f302 "/bin/bash" 2 hours ago Up 2 hours mystifying_gauss
d19d2ef935fa registry "/entrypoint.sh /etc…" 3 hours ago Up 2 hours 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp vigilant_ptolemy
// 进入到容器内,查看是否同步
[root@localhost test1]# docker exec -it 432a25c18f9b /bin/bash
root@432a25c18f9b:/# cd /tmp/myDockerData/
root@432a25c18f9b:/tmp/myDockerData# ll
total 4
drwxr-xr-x. 2 root root 19 Apr 5 13:51 ./
drwxrwxrwt. 1 root root 26 Apr 5 13:45 ../
-rw-r--r--. 1 root root 28 Apr 5 13:51 a.txt
root@432a25c18f9b:/tmp/myDockerData# cat a.txt
我在宿主机内添加的
root@432a25c18f9b:/tmp/myDockerData#
八、Docker安装
1.Docker安装Tomcat
拉取Tomcat镜像,然后启动
[root@localhost test1]# docker search tomcat
[root@localhost test1]# docker pull tomcat
[root@localhost test1]# docker run -it -d -p 8080:8080 tomcat
e7eb0e42f63dc3cb34a71bf49ef941feacd348d64e9e38f327d4f94748717019
启动之后,通过http://192.168.146.144:8080/
访问会404,需要进入容器内,按照下面进行修改
[root@localhost test1]# docker exec -it e7eb0e42f63d /bin/bash
root@e7eb0e42f63d:/usr/local/tomcat# ls -l
total 132
-rw-r--r--. 1 root root 18994 Dec 2 22:01 BUILDING.txt
-rw-r--r--. 1 root root 6210 Dec 2 22:01 CONTRIBUTING.md
-rw-r--r--. 1 root root 60269 Dec 2 22:01 LICENSE
-rw-r--r--. 1 root root 2333 Dec 2 22:01 NOTICE
-rw-r--r--. 1 root root 3378 Dec 2 22:01 README.md
-rw-r--r--. 1 root root 6905 Dec 2 22:01 RELEASE-NOTES
-rw-r--r--. 1 root root 16517 Dec 2 22:01 RUNNING.txt
drwxr-xr-x. 2 root root 4096 Dec 22 17:07 bin
drwxr-xr-x. 1 root root 22 Apr 5 14:30 conf
drwxr-xr-x. 2 root root 4096 Dec 22 17:06 lib
drwxrwxrwx. 1 root root 80 Apr 5 14:30 logs
drwxr-xr-x. 2 root root 159 Dec 22 17:07 native-jni-lib
drwxrwxrwx. 2 root root 30 Dec 22 17:06 temp
drwxr-xr-x. 2 root root 6 Dec 22 17:06 webapps
drwxr-xr-x. 7 root root 81 Dec 2 22:01 webapps.dist
drwxrwxrwx. 2 root root 6 Dec 2 22:01 work
root@e7eb0e42f63d:/usr/local/tomcat# rm -r webapps
root@e7eb0e42f63d:/usr/local/tomcat# mv webapps.dist webapps
上面拉取的是Tomcat最新版,还需要进行配置才能访问到Tomcat页面,那么我们使用的时候,没必要用那么高版本,可以使用其它的镜像,这样pull下来以后直接启动即可
[root@localhost test