All Products
Search
Document Center

CreateContainerGroup

Last Updated: Oct 25, 2018

You can run this command to create a container group.

  1. aliyun eci CreateContainerGroup
  2. --RegionId
  3. --SecurityGroupId
  4. --VSwitchId
  5. --ContainerGroupName
  6. --Containers.n.Image
  7. --Containers.n.Name
  8. --Containers.n.Cpu
  9. --Containers.n.Memory
  10. [--ZoneId]
  11. [--RestartPolicy]
  12. [--Tags.n.Key]
  13. [--Tags.n.Value]
  14. [--ImageRegistryCredentials.n.Server]
  15. [--ImageRegistryCredentials.n.UserName]
  16. [--ImageRegistryCredentials.n.Password]
  17. [--Containers.n.WorkingDir]
  18. [--Containers.n.ImagePullPolicy]
  19. [--Containers.n.Commands.n]
  20. [--Containers.n.Args.n]
  21. [--VolumeMounts.n.MountPath]
  22. [--VolumeMounts.n.ReadOnly]
  23. [--VolumeMounts.n.Name]
  24. [--Ports.n.Protocol]
  25. [--Ports.n.Port]
  26. [--EnvironmentVars.n.Key]
  27. [--EnvironmentVars.n.Value]
  28. [--NFSVolumes.n.Name]
  29. [--NFSVolumes.n.Server]
  30. [--NFSVolumes.n.Path]
  31. [--NFSVolumes.n.ReadOnly]
  32. [--ConfigMapVolumes.n.Name]
  33. [--KeyToPaths.n.Key]
  34. [--KeyToPaths.n.Path]
  35. [--EmptyDirVolumes.n.Name]

Example

You can run the following command to create a container group.

  1. aliyun eci CreateContainerGroup --SecurityGroupId sg-uf66jeqopgqa9hdn2atd --VSwitchId vsw-uf6h3rbwbm90urjwavskd --ContainerGroupName xx --Container.1.Image ubuntu --Container.1.Name u1 --Container.1.Cpu 1 --Container.1.Memory 2
  2. {"ContainerGroupId":"eci-uf6fonnghi50valsr7yw","RequestId":"3061989B-C3D2-41BD-B30F-7F2D4D2B40FB"}

Required parameters

RegionId

The ID of the region in which the instance resides.

SecurityGroupId

The ID of the security group to which the instance belongs. Instances within the same security group can access one another.

VSwitchId

The ID of the VSwitch. Currently, ECI instances can only be deployed in VPCs.

ContainerGroupName

The name of the container group.

Containers.n.Image

The container image.

Containers.n.Name

The name of the container.

Containers.n.Cpu

The central processing unit (CPU) assigned to the container.

Containers.n.Memory

The memory assigned to the container. Unit: GiB.

Optional parameters

ZoneId

The ID of the zone in which the instance resides. If you leave the parameter blank, the system assigns a zone for you. The default value is blank.

RestartPolicy

The policy for restarting the instance. Default value: Always.

Tags.n.Key

The keyword of the tag.

Tags.n.Value

The value of the tag.

ImageRegistryCredentials.n.Server

The address for the image registry server.

ImageRegistryCredentials.n.UserName

The username for logging on to the image registry.

ImageRegistryCredentials.n.Password

The password for logging on to the image registry.

Containers.n.WorkingDir

The working directory for the container.

Containers.n.ImagePullPolicy

The container image pull policy.

Containers.n.Commands.n

The commands run by the container.

Containers.n.Args.n

The arguments passed to the commands.

VolumeMounts.n.MountPath

The path at which the volumes are mounted.

VolumeMounts.n.ReadOnly

Indicates whether the data volume is read only.

VolumeMounts.n.Name

The name of the data volume.

Ports.n.Protocol

The protocol that the exposed port comply with.

Ports.n.Port

The exposed port number.

EnvironmentVars.n.Key

The keyword of the environment variables for the container.

EnvironmentVars.n.Value

The value of the environment variables for the container.

NFSVolumes.n.Name

The name of the NFS volume.

NFSVolumes.n.Server

The address for the NFS server.

NFSVolumes.n.Path

The path at which the NFS volume is mounted.

NFSVolumes.n.ReadOnly

Indicates whether the NFS volume is read only.

ConfigMapVolumes.n.Name

The name of the configuration file.

KeyToPaths.n.Key

KeyToPaths.n.Path

EmptyDirVolumes.n.Name

The name of the EmptyDir volume.