azure az containerapp使用--image参数和--yaml参数创建

toiithl6  于 2023-08-07  发布在  其他
关注(0)|答案(1)|浏览(119)

我正在使用它创建一个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


图像标记被注解掉了,我试图将其作为参数传递给create命令。这就是错误

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


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

llmtgqce

llmtgqce1#

图像标记被注解掉了,我试图将其作为参数传递给create命令。这就是错误

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

字符串
如果在使用Az Cli创建容器应用程序时使用yaml传递配置,则将忽略包含容器应用程序配置的.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

输出:


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



参考使用YAML配置创建容器应用程序并检查YAML配置示例

相关问题