本节学习 查看镜像信息
ls 、tag、inspect 子命令
1、使用images命令列出镜像
[root@iZ2zea4u8pasyhtllbo54oZ ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE nginx latest 602e111c06b6 3 days ago 127MB [root@iZ2zea4u8pasyhtllbo54oZ ~]# docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE nginx latest 602e111c06b6 3 days ago 127MB
REPOSITORY : 来自哪个仓库
TAG:镜像的标签信息
IMAGE ID :镜像的ID,具有唯一性
CREATED :镜像的最后更新时间
SIZE: 镜像大小
2、使用tag命令添加镜像标签
可以使用 docker tag 命令为本地镜像任意添加新的标签
docker tag nginx:latest mynginx:latest
3、使用inspect 命令查看详细信息
使用 docker [image] inspect 命令可以获取该镜像的详细信息、包括作者、架构、各层数字摘要等信息
[root@iZ2zea4u8pasyhtllbo54oZ ~]# docker image inspect mynginx:latest
[
{
"Id": "sha256:602e111c06b6934013578ad80554a074049c59441d9bcd963cb4a7feccede7a5",
"RepoTags": [
"mynginx:latest",
"nginx:latest"
],
"RepoDigests": [
"nginx@sha256:86ae264c3f4acb99b2dee4d0098c40cb8c46dcf9e1148f05d3a51c4df6758c12"
],
"Parent": "",
"Comment": "",
"Created": "2020-04-23T13:03:01.355887897Z",
"Container": "5d118015902f81257aaf639aadc130259632ebe86b1b4dd88f59b4f9a337f872",省略.....
4、使用history 命令 查看镜像历史
使用docker history 可以查看镜像每层的具体内容
[root@iZ2zea4u8pasyhtllbo54oZ ~]# docker history mynginx:latest IMAGE CREATED CREATED BY SIZE COMMENT 602e111c06b6 3 days ago /bin/sh -c #(nop) CMD ["nginx" "-g" "daemon… 0B <missing> 3 days ago /bin/sh -c #(nop) STOPSIGNAL SIGTERM 0B