镜像创建
1. 接口描述¶
本接口用于创建一个镜像实例。
2. 输入参数¶
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| namespace | 是 | Number | 镜像所属空间 |
| image.displayName | 是 | String | 镜像显示名称 |
| image.group | 是 | String | 镜像所属工作组 |
| image.repository | 否 | String | 镜像的docker repo |
| image.price | 否 | Number | 镜像的价格 |
| image.cover | 否 | String | 镜像的封面 |
| image.command | 否 | String | 镜像的启动命令 |
3. 输出参数¶
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| metadata | 是 | Object | 镜像实体的元数据 |
| name | 是 | String | 镜像唯一标识 |
| displayName | 是 | String | 镜像显示名称 |
| group | 是 | String | 镜像所属工作组 |
| repository | 否 | String | 镜像的docker repo |
| price | 否 | Number | 镜像的价格 |
| cover | 否 | String | 镜像的封面 |
| command | 否 | String | 镜像的启动命令 |
| inputs | 是 | Object | 镜像的输入参数 |
| outputs | 是 | Object | 镜像的输出参数 |
| configs | 是 | Object | 镜像的配置参数 |
4. 示例¶
实例1 创建一个普通镜像
在 default 空间下创建一个镜像
输入示例
POST /api/v1/namespaces/default/images
Body
{
image: {
command: ["python3 /home/mediacloud/main_transcode.py --task_id={{inputs.task_id}} --date={{inputs.date}} --log_path={{configs.log_path}} --cache_path={{configs.cache_path}} --input_file={{inputs.input_file}} --output={{outputs.output}} --format={{inputs.format}} --vcodec={{inputs.vcodec}} --acodec={{inputs.acodec}}"],
configs: [{
controls: "input"
default: "/data/y/argon/workdir/default/cache_path"
displayName: "缓存文件路径"
index: 8
kind: "config"
name: "cache_path"
type: "string"
}],
description: "普通整片转码",
displayName: "普通整片转码",
inputs: [{
controls: "input"
default: "-"
displayName: "任务ID"
index: 0
kind: "input"
name: "task_id"
type: "string"
}],
name: "普通整片转码",
outputs: [{
controls: "input"
default: "/data/y/argon/data_path"
displayName: "输出文件路径"
index: 6
kind: "output"
name: "output"
type: "string"
}],
price: "0",
repository: "nvidia/cuda10.1:tensorflow_mgdc-test-v0.1",
}
namespace: "default"
}
输出示例
{
command: ["python3 /home/mediacloud/main_transcode.py --task_id={{inputs.task_id}} --date={{inputs.date}} --log_path={{configs.log_path}} --cache_path={{configs.cache_path}} --input_file={{inputs.input_file}} --output={{outputs.output}} --format={{inputs.format}} --vcodec={{inputs.vcodec}} --acodec={{inputs.acodec}}"],
configs: [{
controls: "input"
default: "/data/y/argon/workdir/default/cache_path"
displayName: "缓存文件路径"
index: 8
kind: "config"
name: "cache_path"
type: "string"
}],
description: "普通整片转码",
displayName: "普通整片转码",
inputs: [{
controls: "input"
default: "-"
displayName: "任务ID"
index: 0
kind: "input"
name: "task_id"
type: "string"
}],
metadata: {clusterName: "default", namespace: "default", uid: "e92964d6-f8b5-4579-a587-00008bf81ac6"},
name: "普通整片转码",
outputs: [{
controls: "input"
default: "/data/y/argon/data_path"
displayName: "输出文件路径"
index: 6
kind: "output"
name: "output"
type: "string"
}],
price: "0",
repository: "nvidia/cuda10.1:tensorflow_mgdc-test-v0.1",
status: {createdAt: "2020-12-21T08:02:13Z", updatedAt: "2020-12-22T01:30:13Z"}
}