你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

New-AzContainerInstanceObject

Create a in-memory object for Container

Syntax

New-AzContainerInstanceObject
   -Image <String>
   -Name <String>
   [-Command <String[]>]
   [-ConfigMapKeyValuePair <IConfigMapKeyValuePairs>]
   [-EnvironmentVariable <IEnvironmentVariable[]>]
   [-LimitCpu <Double>]
   [-LimitMemoryInGb <Double>]
   [-LimitsGpuCount <Int32>]
   [-LimitsGpuSku <String>]
   [-LivenessProbeExecCommand <String[]>]
   [-LivenessProbeFailureThreshold <Int32>]
   [-LivenessProbeHttpGetHttpHeader <IHttpHeader[]>]
   [-LivenessProbeHttpGetPath <String>]
   [-LivenessProbeHttpGetPort <Int32>]
   [-LivenessProbeHttpGetScheme <String>]
   [-LivenessProbeInitialDelaySecond <Int32>]
   [-LivenessProbePeriodSecond <Int32>]
   [-LivenessProbeSuccessThreshold <Int32>]
   [-LivenessProbeTimeoutSecond <Int32>]
   [-Port <IContainerPort[]>]
   [-ReadinessProbeExecCommand <String[]>]
   [-ReadinessProbeFailureThreshold <Int32>]
   [-ReadinessProbeHttpGetHttpHeader <IHttpHeader[]>]
   [-ReadinessProbeHttpGetPath <String>]
   [-ReadinessProbeHttpGetPort <Int32>]
   [-ReadinessProbeHttpGetScheme <String>]
   [-ReadinessProbeInitialDelaySecond <Int32>]
   [-ReadinessProbePeriodSecond <Int32>]
   [-ReadinessProbeSuccessThreshold <Int32>]
   [-ReadinessProbeTimeoutSecond <Int32>]
   [-RequestCpu <Double>]
   [-RequestMemoryInGb <Double>]
   [-RequestsGpuCount <Int32>]
   [-RequestsGpuSku <String>]
   [-VolumeMount <IVolumeMount[]>]
   [<CommonParameters>]

Description

Create a in-memory object for Container

Examples

Example 1: Create a container instance using image alphine with request cpu 1.0 and request memory 1.5Gb

New-AzContainerInstanceObject -Name "test-container" -Image alpine -RequestCpu 1 -RequestMemoryInGb 1.5

Name
----
test-container

Create a container instance using image alphine with request cpu 1.0 and request memory 1.5Gb

Example 2: Create a container instance using image alphine with limit cpu 2.0 and limit memory 2.5Gb

New-AzContainerInstanceObject -Image alpine -Name "test-container" -LimitCpu 2 -LimitMemoryInGb 2.5

Name
----
test-container

Create a container instance using image alphine with limit cpu 2.0 and limit memory 2.5Gb

Example 3: Create a container group with a container instance

$container = New-AzContainerInstanceObject -Name test-container -Image alpine
New-AzContainerGroup -ResourceGroupName testrg-rg -Name test-cg -Location eastus -Container $container

Location Name    Zone ResourceGroupName
-------- ----    ---- -----------------
eastus   test-cg      test-rg

Create a container group with a container instance

Parameters

-Command

The commands to execute within the container instance in exec form.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ConfigMapKeyValuePair

The key value pairs dictionary in the config map to set in the container instance. To construct, see NOTES section for CONFIGMAPKEYVALUEPAIR properties and create a hash table.

Type:IConfigMapKeyValuePairs
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EnvironmentVariable

The environment variables to set in the container instance. To construct, see NOTES section for ENVIRONMENTVARIABLE properties and create a hash table.

Type:IEnvironmentVariable[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Image

The name of the image used to create the container instance.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-LimitCpu

The CPU limit of this container instance.

Type:Double
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LimitMemoryInGb

The memory limit in GB of this container instance.

Type:Double
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LimitsGpuCount

The count of the GPU resource.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LimitsGpuSku

The SKU of the GPU resource.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LivenessProbeExecCommand

The commands to execute within the container.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LivenessProbeFailureThreshold

The failure threshold.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LivenessProbeHttpGetHttpHeader

The HTTP headers for liveness probe. To construct, see NOTES section for LIVENESSPROBEHTTPGETHTTPHEADER properties and create a hash table.

Type:IHttpHeader[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LivenessProbeHttpGetPath

The path to probe.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LivenessProbeHttpGetPort

The port number to probe.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LivenessProbeHttpGetScheme

The scheme.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LivenessProbeInitialDelaySecond

The initial delay seconds.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LivenessProbePeriodSecond

The period seconds.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LivenessProbeSuccessThreshold

The success threshold.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LivenessProbeTimeoutSecond

The timeout seconds.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

The user-provided name of the container instance.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Port

The exposed ports on the container instance. To construct, see NOTES section for PORT properties and create a hash table.

Type:IContainerPort[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ReadinessProbeExecCommand

The commands to execute within the container.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ReadinessProbeFailureThreshold

The failure threshold.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ReadinessProbeHttpGetHttpHeader

The HTTP headers for readiness probe. To construct, see NOTES section for READINESSPROBEHTTPGETHTTPHEADER properties and create a hash table.

Type:IHttpHeader[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ReadinessProbeHttpGetPath

The path to probe.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ReadinessProbeHttpGetPort

The port number to probe.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ReadinessProbeHttpGetScheme

The scheme.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ReadinessProbeInitialDelaySecond

The initial delay seconds.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ReadinessProbePeriodSecond

The period seconds.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ReadinessProbeSuccessThreshold

The success threshold.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ReadinessProbeTimeoutSecond

The timeout seconds.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RequestCpu

The CPU request of this container instance.

Type:Double
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RequestMemoryInGb

The memory request in GB of this container instance.

Type:Double
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RequestsGpuCount

The count of the GPU resource.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RequestsGpuSku

The SKU of the GPU resource.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VolumeMount

The volume mounts available to the container instance. To construct, see NOTES section for VOLUMEMOUNT properties and create a hash table.

Type:IVolumeMount[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Container