镜像操作命令表格
| docker image 子命令 |
docker子命令 |
功能 |
| docker image build |
docker build |
从Dockerfile开始构建镜像 |
| docker image history |
docker history |
显示镜像的历史记录 |
| docker image import |
docker import |
从tarball文件导入内容以创建文件系统镜像 |
| docker image inspect |
docker ispect |
显示一个或多个镜像文件的详细信息 |
| docker image load |
docker load |
从tar档案文件或者STDIN装载镜像 |
| docker image ls |
docker images |
输出镜像列表 |
| docker image prune |
无 |
删除未使用的镜像 |
| docker image pull |
docker pull |
从注册服务器拉取镜像或镜像仓库 |
| docker image push |
docker push |
将镜像或者镜像仓库推送到注册服务器 |
| docker image rm |
docker rmi |
删除一个或者多个镜像 |
| docker image save |
docker save |
将一个或者多个镜像保存在tar存档(默认情况下流式传输到STDOUT) |
| docker image tag |
docker tag |
为指向源镜像的目标镜像添加一个名称 |
docker镜像拉取
[root@hmm ~] docker pull ubuntu:14.04
docker镜像查看
- docker images
- docker image ls
[root@hmm ~] docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest 3db8720ecbf5 3 weeks ago 77.9MB
ubuntu 18.04 f9a80a55f492 9 months ago 63.2MB
hello-world latest d2c94e258dcb 10 months ago 13.3kB
ubuntu 14.04 13b66b487594 2 years ago 197MB
[root@hmm ~]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest 3db8720ecbf5 3 weeks ago 77.9MB
ubuntu 18.04 f9a80a55f492 9 months ago 63.2MB
hello-world latest d2c94e258dcb 10 months ago 13.3kB
ubuntu 14.04 13b66b487594 2 years ago 197M
其他
[root@hmm ~]docker images -h
Usage: docker images [OPTIONS] [REPOSITORY[:TAG]] # 使用语法
List images
Aliases: # 关联的命令
docker image ls, docker image list, docker images # 这三个命令效果等效
Options:
-a, --all Show all images (default hides intermediate images)
# 显示所有镜像(默认会隐藏中间镜像)
--digests Show digests # 显示镜像摘要值
-f, --filter filter Filter output based on conditions provided # 筛选镜像
--format string Format output using a custom template: # 格式化输出
'table': Print output in table format
with column headers (default)
'table TEMPLATE': Print output in table format
using the given Go template
'json': Print in JSON format
'TEMPLATE': Print output using the given
Go template.
Refer to https://docs.docker.com/go/formatting/
for more information about formatting output with
templates
--no-trunc Don't truncate output # 不截断输出
-q, --quiet Only show image IDs # 只显示镜像ID