Docker history命令

docker history命令教程

docker history 命令用于打印出指定的 Docker镜像 的历史版本信息。

docker history命令语法

haicoder(www.haicoder.net)# docker history [OPTIONS] IMAGE

docker history命令参数

参数 描述
docker history -H, --human 以可读的格式打印镜像大小和日期,默认为 true。
docker history --no-trunc 显示完整的提交记录。
docker history -q, --quiet 仅列出提交记录 ID。

案例

查看镜像的提交历史

我们使用 docker history 命令,查看 centos 镜像的历史记录。

#要想下面指令成功,要先 pull centos 哦 haicoder(www.haicoder.net)# docker history centos

获取完成后,终端显示如下:

03 docker history.png

仅显示镜像的提交历史 ID

我们使用 docker history 命令,可以仅显示 centos 镜像的历史记录的 ID。

haicoder(www.haicoder.net)# docker history -q centos

获取完成后,终端显示如下:

04 docker history.png

docker history命令总结

docker history 命令用于打印出指定的 Docker镜像的历史版本信息。

docker history -q centos 命令用于仅显示 centos 镜像的历史记录的 ID。