(九)10个镜像相关的API
最后更新于:2022-04-01 23:05:11
# Docker入门教程(九)10个镜像相关的API
> 【编者的话】DockerOne组织翻译了Flux7的Docker入门教程,本文是系列入门教程的第九篇,重点介绍了镜像相关的Docker Remote API。
在[Docker系列教程的上一篇文章](http://dockerone.com/article/109)中,我们讨论了Docker Remote API,并具体学习了有关容器的命令。在这篇文章中,我们将讨论有关镜像的命令。
#### 创建镜像
镜像可以通过以下两种方式来创建:
* 从Registry中提取
* 导入镜像
`POST /images/create`
截图示例:
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/0d0f20040d142a5fd847f8e39a62084c_819x477.jpg)
#### 利用容器创建镜像
`POST /commit`
截图示例:
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/64f21b9d7e26166de967a755a14209bb_819x609.png)
#### 获取镜像清单:
`GET /images/json`
截图示例:
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/4f8f3f41fd52e86ae0478b54714b7bb3_819x609.png)
#### Insert a File
导入指定的路径文件:
`POST /images/(name)/insert`
截图示例:
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/c4432fdcb88bfb20eb7fb29ca99b7ff4_818x427.jpg)
#### 删除镜像:
`DELETE /images/(name)`
截图示例:
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/abcc5abf938125852080d14d88fd918e_818x384.jpg)
#### 推送镜像到Registry
`POST /images/(name)/push`
截图示例:
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/a35d0ae16984e6dd91da64b417811c67_1280x775.png)
#### Tag镜像
`POST /images/(name)/tag`
截图示例:
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/e0d7a169789c4a72fdc5075b16aef0f4_818x367.jpg)
#### 搜索镜像:
`GET /images/search`
截图示例:
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/d14ab3ca7400438071e12b06c56379f7_819x609.png)
#### 查看镜像历史
`GET /images/(name)/history`
截图示例:
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/eac40a6425512b296ed7798898ff2832_819x433.jpg)
#### 构建镜像
`POST /build`
截图示例:
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/9ad843104668dda17c6be73610608ae0_1280x775.png)
> 出处:http://dockone.io/article/110
> 原文链接:[10 Docker Remote API Commands for Images](http://blog.flux7.com/blogs/docker/docker-tutorial-series-part-9-10-docker-remote-api-commands-for-images)(翻译:[田浩浩](https://github.com/llitfkitfk) 审校:李颖杰)
';