Custom-image-builder aims to help users quickly build their own system images in a docker environment. Now we support two ways to build system image:
- Parametric construction of the mirror, the customer enters the required fields to complete the construction.
- The customer himself mounts alicloud.json through the volume to complete the construction with the container.
- CentOS 7.6/7.7
- Aliyun Linux 2 (Alibaba Cloud Linux 2)
1.Use build.sh
$ bash build.sh example/ack-centos.json
required:
- IMAGE_NAME(custom)
- Alicloud ACCESS_KEY
- Alicloud SECRET_KEY
- REGION
- INSTANCE_TYPE
2.Build the OS image By mounting custom alicloud.json
$ docker run -v $hostPath:$containerPath registry.aliyuncs.com/acs/custom-sys-image:v1.0.0 $containerPath/alicloud.json
When executing the build task, as follows:
The system image is built, as follows:
If you are using a sub account,the ram policy should at least include actions as below:
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeImages",
"ecs:CreateImage",
"ecs:ModifyImageSharePermission",
"ecs:CreateKeyPair",
"ecs:DeleteKeyPairs",
"ecs:DetachKeyPair",
"ecs:AttachKeyPair",
"ecs:CreateSecurityGroup",
"ecs:DeleteSecurityGroup",
"ecs:AuthorizeSecurityGroupEgress",
"ecs:AuthorizeSecurityGroup",
"ecs:CreateSnapshot",
"ecs:AttachDisk",
"ecs:DetachDisk",
"ecs:DescribeDisks",
"ecs:CreateDisk",
"ecs:DeleteDisk",
"ecs:CreateNetworkInterface",
"ecs:DescribeNetworkInterfaces",
"ecs:AttachNetworkInterface",
"ecs:DetachNetworkInterface",
"ecs:DeleteNetworkInterface",
"ecs:DescribeInstanceAttribute",
"ecs:CreateInstance",
"ecs:DeleteInstance",
"ecs:StartInstance",
"ecs:StopInstance",
"ecs:DescribeInstances"
],
"Resource": [
"*"
],
"Effect": "Allow"
},
{
"Action": [
"vpc:CreateVpc",
"vpc:DeleteVpc",
"vpc:DescribeVpcs",
"vpc:CreateVSwitch",
"vpc:DeleteVSwitch",
"vpc:DescribeVSwitches",
"vpc:AllocateEipAddress",
"vpc:AssociateEipAddress",
"vpc:UnassociateEipAddress",
"vpc:DescribeEipAddresses",
"vpc:ReleaseEipAddress"
],
"Resource": [
"*"
],
"Effect": "Allow"
}
]
}