Builds a custom image based on the specified configuration. After the image is successfully built, it is added to the list of custom images in the current workspace.
Operation description
Description
Try it now
Test
RAM authorization
Request syntax
POST /api/v1/imagebuilds HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ClientToken |
string |
No |
An idempotence token. |
123e4567-e89b-12d3-a456-426655440000 |
| body |
object |
No |
The request body. |
|
| Accessibility |
string |
No |
The visibility of the image.
Valid values:
|
PUBLIC |
| WorkspaceId |
string |
Yes |
The workspace ID. |
12345 |
| Resource |
object |
Yes |
The resources used to run the task. |
|
| EcsSpec |
string |
No |
The instance type of the pay-as-you-go resource. This parameter is required when you use the public resource group. |
ecs.c6.large |
| ResourceConfig |
object |
No |
The resource configuration. Specify this parameter when you use subscription resources. Leave it empty when you use the public resource group. |
|
| CPU |
string |
No |
The number of CPU cores. |
4 |
| Memory |
string |
No |
The memory size. |
8Gi |
| ResourceId |
string |
No |
The resource quota ID. This parameter applies only to subscription resources. Do not set this parameter for pay-as-you-go resources. |
quotaadzoqup693z |
| ResourceType |
string |
No |
The type of the subscription resource. Currently, only Lingjun resources are supported. Specify this parameter when you use subscription resources. Valid values:
|
Lingjun |
| UserVpc |
object |
No |
The information about the user's virtual private cloud (VPC). This parameter is required when you use the public resource group. |
|
| VpcId |
string |
No |
The VPC ID. If the build task needs to access your ACR Enterprise Edition instance, specify a VPC that is in the access control list of the instance. |
vpc-abcdef** |
| SwitchId |
string |
No |
The vSwitch ID. This parameter is optional. |
vs-abcdef** |
| SecurityGroupId |
string |
No |
The security group ID. This parameter is required when you configure a VPC. |
sg-abcdef** |
| ExtendedCidrs |
array |
No |
The extended CIDR blocks.
|
|
|
string |
No |
An extended CIDR block. |
10.0.0.0/24 |
|
| DefaultRoute |
string |
No |
The default route.
|
eth1 |
| TargetRegistry |
object |
Yes |
The configuration of the target image repository. |
|
| InstanceId |
string |
No |
The ID of the image repository instance. This parameter is required when you use ACR as the image repository. |
cri-**abcd |
| Type |
string |
Yes |
The type of the target image repository. Only ACR Enterprise Edition is supported. |
AcrEnterprise |
| OverwriteImageTag |
boolean |
No |
Specifies whether to overwrite an existing image version in the image repository. |
|
| BuildConfig |
object |
Yes |
The build configuration. Specify the content of the Dockerfile to be built. |
|
| Dockerfile |
string |
Yes |
The content of the Dockerfile to be built. |
FROM ubuntu:18:04 RUN pip3 install numpy==1.19.5 |
| BuildType |
string |
Yes |
The build type. The following types are supported:
|
PackageInstallation |
| RegistryAuths |
object |
No |
The authentication information for the private image repository. You can specify the authentication information for an ACR image repository that does not belong to you. The format is `{"user_registry_domain":{"Auth":"base64 encoded auth"}}`. |
{ "user-test-registry-vpc.cn-wulanchabu.cr.aliyuncs.com": { "Auth": "dXNlcjp0ZXN0" } } |
| RegionId |
string |
No |
The region ID. |
cn-wulanchabu |
| ImageBuildJobName |
string |
No |
The name of the image build task. |
build-my-image |
| Image |
object |
Yes |
The metadata of the image. |
|
| Name |
string |
Yes |
The name of the image. The name must meet the following requirements:
|
test-v1 |
| Description |
string |
No |
The description of the image. |
构建测试镜像 |
| Uri |
string |
Yes |
The image URL. |
user-test-registry-vpc.cn-wulanchabu.cr.aliyuncs.com/pai-test/pai-test:test-v1 |
| Labels |
array<object> |
No |
The image labels. |
|
|
object |
No |
|||
| Key |
string |
No |
The key of the image label. |
key1 |
| Value |
string |
No |
The value of the image label. |
value1 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response that is returned. |
||
| ImageBuildId |
string |
The image build ID. |
build-****ks92 |
| ImageBuildJobId |
string |
The build task ID. |
dlc-****ks92 |
Examples
Success response
JSON format
{
"ImageBuildId": "build-****ks92",
"ImageBuildJobId": "dlc-****ks92"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.