?
This document uses PHP Chinese website manual Release
顯示圖像的歷史
docker history [OPTIONS] IMAGE
名字,簡(jiǎn)寫 | 默認(rèn) | 描述 |
---|---|---|
--format | 使用Go模板打印出漂亮的圖像 | |
--human, -H | true | 以可讀格式打印大小和日期 |
--no-TRUNC | false | 不要截?cái)噍敵?/p> |
--quiet,-q | false | 只顯示數(shù)字ID |
命令 | 描述 |
---|---|
docker | Docker CLI的基本命令。 |
要了解docker:latest
圖像是如何構(gòu)建的:
$ docker history docker IMAGE CREATED CREATED BY SIZE COMMENT 3e23a5875458 8 days ago /bin/sh -c #(nop) ENV LC_ALL=C.UTF-8 0 B 8578938dd170 8 days ago /bin/sh -c dpkg-reconfigure locales && loc 1.245 MB be51b77efb42 8 days ago /bin/sh -c apt-get update && apt-get install 338.3 MB 4b137612be55 6 weeks ago /bin/sh -c #(nop) ADD jessie.tar.xz in / 121 MB 750d58736b4b 6 weeks ago /bin/sh -c #(nop) MAINTAINER Tianon Gravi <ad 0 B 511136ea3c5a 9 months ago 0 B Imported from -
要查看docker:apache
圖像如何添加到容器的基本圖像:
$ docker history docker:scm IMAGE CREATED CREATED BY SIZE COMMENT 2ac9d1098bf1 3 months ago /bin/bash 241.4 MB Added Apache to Fedora base image 88b42ffd1f7c 5 months ago /bin/sh -c #(nop) ADD file:1fd8d7f9f6557cafc7 373.7 MB c69cab00d6ef 5 months ago /bin/sh -c #(nop) MAINTAINER Lokesh Mandvekar 0 B 511136ea3c5a 19 months ago 0 B Imported from -
格式化選項(xiàng)(--format
)將使用 Go 模板顯示歷史輸出。
下面列出了 Go 模板的有效占位符:
占位符 | 描述 |
---|---|
。ID | 圖像ID |
.CreatedSince | 如果--human = true,則創(chuàng)建圖像以來的耗時(shí),否則創(chuàng)建圖像時(shí)的時(shí)間戳 |
.CreatedAt | 何時(shí)創(chuàng)建圖像的時(shí)間戳 |
.CreatedBy | 用于創(chuàng)建圖像的命令 |
.Size | 映像磁盤大小 |
.Comment | 評(píng)論形象 |
當(dāng)使用--format
選項(xiàng)時(shí),history
命令將完全按照模板聲明輸出數(shù)據(jù),或者在使用該table
指令時(shí)也會(huì)包含列標(biāo)題。
以下示例使用不帶標(biāo)題的模板,并輸出由冒號(hào)分隔的所有圖像ID
和CreatedSince
條目:
$ docker images --format "{{.ID}}: {{.Created}} ago"cc1b61406712: 2 weeks ago<missing>: 2 weeks ago<missing>: 2 weeks ago<missing>: 2 weeks ago<missing>: 2 weeks ago<missing>: 3 weeks ago<missing>: 3 weeks ago<missing>: 3 weeks ago