New-AzureRmContainerGroup
컨테이너 그룹을 만듭니다.
Warning
AzureRM PowerShell 모듈은 2024년 2월 29일부터 공식적으로 사용되지 않습니다. 사용자는 지속적인 지원 및 업데이트를 보장하기 위해 AzureRM에서 Az PowerShell 모듈로 마이그레이션하는 것이 좋습니다.
AzureRM 모듈은 여전히 작동할 수 있지만 더 이상 기본 또는 지원되지 않으므로 사용자의 재량에 따라 계속 사용할 수 있습니다. Az 모듈로 전환하는 방법에 대한 지침은 마이그레이션 리소스를 참조하세요.
Syntax
New-AzureRmContainerGroup
[-ResourceGroupName] <String>
[-Name] <String>
[-Image] <String>
[-RegistryCredential <PSCredential>]
[-Location <String>]
[-OsType <String>]
[-RestartPolicy <String>]
[-Cpu <Int32>]
[-MemoryInGB <Double>]
[-IpAddressType <String>]
[-DnsNameLabel <String>]
[-Port <Int32[]>]
[-Command <String>]
[-EnvironmentVariable <Hashtable>]
[-RegistryServerDomain <String>]
[-Tag <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzureRmContainerGroup
[-ResourceGroupName] <String>
[-Name] <String>
[-Image] <String>
[-RegistryCredential <PSCredential>]
-AzureFileVolumeShareName <String>
-AzureFileVolumeAccountCredential <PSCredential>
-AzureFileVolumeMountPath <String>
[-Location <String>]
[-OsType <String>]
[-RestartPolicy <String>]
[-Cpu <Int32>]
[-MemoryInGB <Double>]
[-IpAddressType <String>]
[-DnsNameLabel <String>]
[-Port <Int32[]>]
[-Command <String>]
[-EnvironmentVariable <Hashtable>]
[-RegistryServerDomain <String>]
[-Tag <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
New-AzureRmContainerGroup cmdlet은 컨테이너 그룹을 만듭니다.
예제
예 1
PS C:\> New-AzureRmContainerGroup -ResourceGroupName demo -Name mycontainer -Image nginx -OsType Linux -IpAddressType Public -Port @(8000)
ResourceGroupName : demo
Id : /subscriptions/ae43b1e3-c35d-4c8c-bc0d-f148b4c52b78/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/mycontainer
Name : mycontainer
Type : Microsoft.ContainerInstance/containerGroups
Location : westus
Tags :
ProvisioningState : Creating
Containers : {mycontainer}
ImageRegistryCredentials :
RestartPolicy :
IpAddress : 13.88.10.240
Ports : {8000}
OsType : Linux
Volumes :
State : Running
Events : {}
이 명령은 최신 nginx 이미지를 사용하여 컨테이너 그룹을 만들고 포트 8000을 여는 공용 IP 주소를 요청합니다.
예제 2
PS C:\> New-AzureRmContainerGroup -ResourceGroupName demo -Name mycontainer -Image alpine -OsType Linux -Command "/bin/sh -c myscript.sh" -EnvironmentVariable @{"env1"="value1";"env2"="value2"}
ResourceGroupName : demo
Id : /subscriptions/ae43b1e3-c35d-4c8c-bc0d-f148b4c52b78/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/mycontainer
Name : mycontainer
Type : Microsoft.ContainerInstance/containerGroups
Location : westus
Tags :
ProvisioningState : Creating
Containers : {mycontainer}
ImageRegistryCredentials :
RestartPolicy :
IpAddress :
Ports :
OsType : Linux
Volumes :
State : Running
Events : {}
이 명령은 컨테이너 그룹을 만들고 컨테이너 내에서 사용자 지정 스크립트를 실행합니다.
예제 3: 실행-완료 컨테이너 그룹을 만듭니다.
PS C:\> New-AzureRmContainerGroup -ResourceGroupName demo -Name mycontainer -Image alpine -OsType Linux -Command "echo hello" -RestartPolicy Never
ResourceGroupName : demo
Id : /subscriptions/ae43b1e3-c35d-4c8c-bc0d-f148b4c52b78/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/mycontainer
Name : mycontainer
Type : Microsoft.ContainerInstance/containerGroups
Location : westus
Tags :
ProvisioningState : Creating
Containers : {mycontainer}
ImageRegistryCredentials :
RestartPolicy :
IpAddress :
Ports :
OsType : Linux
Volumes :
State : Running
Events : {}
이 명령은 'hello'를 출력하고 중지하는 컨테이너 그룹을 만듭니다.
예제 4: Azure Container Registry에서 이미지를 사용하여 컨테이너 그룹 만들기
PS C:\> $secpasswd = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force
PS C:\> $mycred = New-Object System.Management.Automation.PSCredential ("myacr", $secpasswd)
PS C:\> New-AzureRmContainerGroup -ResourceGroupName demo -Name mycontainer -Image myacr.azurecr.io/nginx:latest -IpAddressType Public -RegistryCredential $mycred
ResourceGroupName : demo
Id : /subscriptions/ae43b1e3-c35d-4c8c-bc0d-f148b4c52b78/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/mycontainer
Name : mycontainer
Type : Microsoft.ContainerInstance/containerGroups
Location : westus
Tags :
ProvisioningState : Creating
Containers : {mycontainer}
ImageRegistryCredentials : {myacr}
RestartPolicy :
IpAddress : 13.88.10.240
Ports : {80}
OsType : Linux
Volumes :
State : Running
Events : {}
이 명령은 Azure Container Registry에서 nginx 이미지를 사용하여 컨테이너 그룹을 만듭니다.
예제 5: 사용자 지정 컨테이너 이미지 레지스트리에서 이미지를 사용하여 컨테이너 그룹 만들기
PS C:\> $secpasswd = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force
PS C:\> $mycred = New-Object System.Management.Automation.PSCredential ("username", $secpasswd)
PS C:\> New-AzureRmContainerGroup -ResourceGroupName MyResourceGroup -Name MyContainer -Image myserver.com/myimage:latest -RegistryServer myserver.com -RegistryCredential $mycred
ResourceGroupName : demo
Id : /subscriptions/ae43b1e3-c35d-4c8c-bc0d-f148b4c52b78/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/mycontainer
Name : mycontainer
Type : Microsoft.ContainerInstance/containerGroups
Location : westus
Tags :
ProvisioningState : Creating
Containers : {mycontainer}
ImageRegistryCredentials : {myserver.com}
RestartPolicy :
IpAddress : 13.88.10.240
Ports : {80}
OsType : Linux
Volumes :
State : Running
Events : {}
이 명령은 사용자 지정 컨테이너 이미지 레지스트리에서 사용자 지정 이미지를 사용하여 컨테이너 그룹을 만듭니다.
예제 6: Azure File 볼륨을 탑재하는 컨테이너 그룹을 만듭니다.
PS C:\> $secpasswd = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force
PS C:\> $mycred = New-Object System.Management.Automation.PSCredential ("username", $secpasswd)
PS C:\> New-AzureRmContainerGroup -ResourceGroupName MyResourceGroup -Name MyContainer -Image alpine -AzureFileVolumeShareName myshare -AzureFileVolumeAccountKey $mycred -AzureFileVolumeMountPath /mnt/azfile
ResourceGroupName : demo
Id : /subscriptions/ae43b1e3-c35d-4c8c-bc0d-f148b4c52b78/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/mycontainer
Name : mycontainer
Type : Microsoft.ContainerInstance/containerGroups
Location : westus
Tags :
ProvisioningState : Creating
Containers : {mycontainer}
ImageRegistryCredentials : {myserver.com}
RestartPolicy :
IpAddress : 13.88.10.240
Ports : {80}
OsType : Linux
Volumes : {AzureFile}
State : Running
Events : {}
이 명령은 제공된 Azure 파일 공유 /mnt/azfile
를 탑재하는 컨테이너 그룹을 만듭니다.
매개 변수
-AzureFileVolumeAccountCredential
사용자 이름이 스토리지 계정 이름이고 키가 스토리지 계정 키인 경우 탑재할 Azure 파일 공유의 스토리지 계정 자격 증명입니다.
Type: | PSCredential |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-AzureFileVolumeMountPath
Azure 파일 볼륨의 탑재 경로입니다.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-AzureFileVolumeShareName
탑재할 Azure 파일 공유의 이름입니다.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Command
컨테이너에서 실행할 명령입니다.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Confirm
cmdlet을 실행하기 전에 확인 메시지가 표시됩니다.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Cpu
필요한 CPU 코어입니다. 기본값: 1
Type: | Nullable<T>[Int32] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
Azure와의 통신에 사용되는 자격 증명, 계정, 테넌트 및 구독입니다.
Type: | IAzureContextContainer |
Aliases: | AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DnsNameLabel
IP 주소의 DNS 이름 레이블입니다.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-EnvironmentVariable
컨테이너 환경 변수입니다.
Type: | Hashtable |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Image
컨테이너 이미지입니다.
Type: | String |
Position: | 2 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-IpAddressType
IP 주소 유형입니다.
Type: | String |
Accepted values: | Public |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Location
컨테이너 그룹 위치입니다. 기본값은 리소스 그룹의 위치입니다.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MemoryInGB
필요한 메모리(GB)입니다. 기본값: 1.5
Type: | Nullable<T>[Double] |
Aliases: | Memory |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Name
컨테이너 그룹 이름입니다.
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-OsType
컨테이너 OS 유형입니다. 기본값: Linux
Type: | String |
Accepted values: | Linux, Windows |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Port
열 포트입니다. 기본값: [80]
Type: | Int32[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RegistryCredential
사용자 지정 컨테이너 레지스트리 자격 증명입니다.
Type: | PSCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RegistryServerDomain
사용자 지정 컨테이너 레지스트리 로그인 서버입니다.
Type: | String |
Aliases: | RegistryServer |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResourceGroupName
리소스 그룹 이름입니다.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-RestartPolicy
컨테이너 다시 시작 정책입니다. 기본값: 항상
Type: | String |
Accepted values: | Always, Never, OnFailure |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Tag
{{태그 설명 채우기}}
Type: | Hashtable |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-WhatIf
cmdlet이 실행될 경우 결과 동작을 표시합니다. cmdlet이 실행되지 않습니다.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |