我正在使用它来创建一个天蓝色容器应用程序
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 配置文件中提供其他参数??
当我尝试添加入口设置时出现以下错误。对此有什么见解吗?
properties:
configuration:
ingress:
external: true
targetPort: 443
错误请求({"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"发生一个或多个验证错误。","status":400 ,"traceId":"xxxxxxxxxxxxxx","errors":{"$":["JSON 值无法转换为 System.Boolean。路径: $ | LineNumber: 0 | BytePositionInLine: 4。"]}})
图像标签被注释掉,我试图将其作为参数传递 到创建命令。这是错误
(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
输出:
运行上述命令后,容器应用程序将在门户中成功创建,如下所示。
参考 使用 YAML 配置创建容器应用程序并检查 示例 YAML 配置