gpt4 book ai didi

azure - az containerapp create 使用 --image 参数和 --yaml 参数

转载 作者:行者123 更新时间:2023-12-03 04:40:11 30 4
gpt4 key购买 nike

我正在使用它来创建一个 azure 容器应用程序

az containerapp create -n sample -g my-container-app-env --image sampleapi-docker-build.domainname/sample-dotnet:2.0.2989 --yaml ./configuration.yml

在我的configuration.yml文件中

template:
containers:
- name: sample-dotnet
#image: sampleapi-docker-verify.domain/sample-dotnet:2.0.2989
resources:
cpu: 0.25
memory: .5Gi

图像标签被注释掉,我试图将其作为参数传递给创建命令。这是错误

(ContainerAppImageRequired) Container with name 'sample-dotnet' must have an 'Image' property specified.

如何在 create 命令中提供一些参数并在 yaml 配置文件中提供其他参数?

最佳答案

The image tag is commented out, I am trying to pass it as an argumentto the create command. This is the error

(ContainerAppImageRequired) Container with name 'sample-dotnet' must have an '```
'Image' property specified

如果使用yaml传递配置当您使用 Az Cli 创建容器应用程序时路径.yaml具有容器应用程序配置的文件和其余所有其他参数将被忽略。检查MS Doc供您引用。

要解决此问题,请传递除容器应用名称和资源组名称之外的所有配置

用于创建容器应用程序的 Azure Cli 命令。

az containerapp create -n mywebapp -g Sri --yaml "C:\Users\user\configuration.yml"

配置.yml

    location: "West US 2"
type: Microsoft.App/containerApps
properties:
managedEnvironmentId: /subscriptions/7195d375-7af2-43f1-bd66-12e77ac05818/resourceGroups/Sri/providers/Microsoft.App/managedEnvironments/managedEnvironment-Sri-b57d
configuration:
secrets:
- name: myregistrypassword
value: xxxxxxxxxxKPzkmJIXiTn/MCKkvNAL+ACRCDlME+
registries:
- passwordSecretRef: myregistrypassword
server: vnfhfhf.azurecr.io
username: venkattest
template:
containers:
- image: venkattest.fnfnf .io/mywebapp:v1
name: mywebapp

输出:

enter image description here

运行上述命令后,容器应用程序将在门户中成功创建,如下所示。

enter image description here

引用Create a container app using a YAML configuration并检查example YAML configuration

关于azure - az containerapp create 使用 --image 参数和 --yaml 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76776106/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com