根据服务实例 ID 查看详细信息。

请求信息

请求行 RequestLine

GET /services/{service_id} HTTP/1.1

请求行参数 URI Param

名称 类型 是否必须 描述
service_id string 服务实例 ID, 格式为 {project_name}_{service_name}

特有请求头 RequestHead

请求体 RequestBody

返回信息

返回行 ResponseLine

HTTP/1.1 200 OK

特有返回头 ResponseHead

返回体 ResponseBody

{
    "id": "string",
    "name": "string",
    "project": "string",
    "description": "string",
    "created": "datetime",
    "updated": "datetime",
    "desired_state": "string",
    "current_state": "string",
    "definition": {
       "key": "value",
       ...
    },
    "extensions": {
       "key": "value",
       ...
    },
    "containers": {
       "key": "value",
       ...
    }
}

返回体解释

服务实例的格式

名称 类型 描述
id string 服务 ID
name string 服务名称
project string 应用名称
created datetime 服务创建时间
updated datetime 服务更新时间
desired_state string 期望状态 (如果当前状态是中间状态时,期望状态指明变迁终态)
current_state string 当前状态
definition map Compose 中服务定义 key/value
extensions map 容器服务 Compose 中服务扩展 key/value
containers map 服务中所包含容器 key (容器 ID)/value(属性)

示例

请求示例

GET /services/wordpress_db HTTP/1.1

返回示例

HTTP/1.1 200 Ok
Content-Type:application/json;charset=UTF-8
{
  "id": "wordpress_db",
  "name": "db",
  "project": "wordpress",
  "definition": {
    "environment": [
      "MYSQL_ROOT_PASSWORD=password"
    ],
    "image": "mysql:5.7",
    "restart": "always"
  },
  "extensions": {
    "scale": 1,
    "logs": [
      "/var/log/mysql"
    ]
  },
  "created": "2016-04-21T13:36:32.440646459Z",
  "updated": "2016-04-21T13:36:33.270308958Z",
  "desired_state": "running",
  "current_state": "running",
  "containers": {
    "5616f05d27516b3502a391fd2ca9d312cabffa5ad431bf261ea81f4ceabd476e": {
      "name": "/wordpress_db_1",
      "node": "10.246.2.3",
      "ip": "10.0.0.2",
      "running": true,
      "status": "running",
      "health": "success"
    }
  }
}