以下是一個範例:mcr.microsoft.com/azure-cognitive-services/keyphrase,代表 Azure AI 服務存放庫下 Microsoft Container Registry 中的關鍵片語擷取映像。 另一個範例是 containerpreview.azurecr.io/microsoft/cognitive-services-speech-to-text,代表容器預覽容器登錄之 Microsoft 存放庫中的語音轉換文字映像。
apiVersion: 2018-10-01
location: # < Valid location >
name: # < Container Group name >
properties:
imageRegistryCredentials: # This is only required if you are pulling a non-public image that requires authentication to access. For example Text Analytics for health.
- server: containerpreview.azurecr.io
username: # < The username for the preview container registry >
password: # < The password for the preview container registry >
containers:
- name: # < Container name >
properties:
image: # < Repository/Image name >
environmentVariables: # These env vars are required
- name: eula
value: accept
- name: billing
value: # < Service specific Endpoint URL >
- name: apikey
value: # < Service specific API key >
resources:
requests:
cpu: 4 # Always refer to recommended minimal resources
memoryInGb: 8 # Always refer to recommended minimal resources
ports:
- port: 5000
osType: Linux
volumes: # This node, is only required for container instances that pull their model in at runtime, such as LUIS.
- name: aci-file-share
azureFile:
shareName: # < File share name >
storageAccountName: # < Storage account name>
storageAccountKey: # < Storage account key >
restartPolicy: OnFailure
ipAddress:
type: Public
ports:
- protocol: tcp
port: 5000
tags: null
type: Microsoft.ContainerInstance/containerGroups
注意
並非所有位置都有相同的 CPU 和記憶體可用性。 如需每個位置和 OS 的容器可用資源清單,請參閱位置和資源表格。
我們會依賴我們為 az container create 命令建立的 YAML 檔案。 從 Azure CLI 中,執行 az container create 命令,並將 <resource-group> 取代為您自己的值。 此外,若要保護 YAML 部署內的值,請參閱安全值。
az container create -g <resource-group> -f my-aci.yaml