Docker入门教程(八)Docker Remote API

jopen 9年前

Docker教程系列的上一章中,我们讨论Docker Hub 以及 Docker Registry API。在今天的文章里,让我们深入探讨Docker Remote API。

Docker Remote API

Docker Remote API是取代rcli(远程命令行界面)的REST API。对于本教程的目的,我们使用一个命令行工具cURL来处理url操作。它有助于发出请求、获取与发送数据并且检索信息。

List containers

获取所有容器的清单:
GET /containers/json


Create a new container

创建新的容器:
POST /containers/create


Inspect Container

使用容器id获取该容器底层信息:
GET /containers/(id)/json


Process List

获取容器内进程的清单:
GET /containers/(id)/top


Container Logs

获取容器的标准输出和错误日志:
GET /containers/(id)/logs


Export Container

导出容器内容:
GET /containers/(id)/export


Start a container

开启容器:
POST /containers/(id)/start


Stop a container

停止容器:
POST /containers/(id)/stop


Restart a Container

重启容器:
POST /containers/(id)/restart


Kill a container

终止容器:
POST /containers/(id)/kill


现在,我们已经带您领略了Docker API的第二站, Docker教程系列下一章会了解有关镜像的Docker Remote API命令。我们所有的Docker教程系列你可以在 这里找到。