从 Azure PowerShell 部署容器组

问题描述 投票:0回答:2

我正在按照 Microsoft 的指南部署带有 sidecar 的容器以进行 HTTPS 访问此处。但是,我正在尝试使用我的一张图像,该图像已推送到 ACR。我遵循所有步骤直到

az container create --resource-group <myResourceGroup> --file deploy-aci.yaml

我的deploy-aci.yaml 文件的内容如下:

api-version: 2019-05-01
location: switzerlandnorth
name: app-with-ssl
properties:
  containers:
  - name: nginx-with-ssl
    properties:
      image: mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine
      ports:
      - port: 443
        protocol: TCP
      resources:
        requests:
          cpu: 1.0
          memoryInGB: 1.5
      volumeMounts:
      - name: nginx-config
        mountPath: /etc/nginx
  - name: my-container
    properties:
      image: my-registry/my-image:latest
      ports:
      - port: 80
        protocol: TCP
      resources:
        requests:
          cpu: 1.0
          memoryInGB: 1.5
  volumes:
  - secret:
      ssl.crt: base64-encoded-cert
      ssl.key: base64-encoded-key
      nginx.conf: base64-encoded-conf-content
    name: nginx-config
  ipAddress:
    ports:
    - port: 443
      protocol: TCP
    type: Public
  osType: Linux
tags: null
type: Microsoft.ContainerInstance/containerGroups

当尝试运行上面的容器创建命令时,我收到此错误:

(InaccessibleImage) 图像 '我的注册表/我的图像:最新' 在容器组“app-with-ssl”中无法访问。请检查 图像和注册表凭据。代码:InaccessibleImage 消息: 图像 '我的注册表/我的图像:最新' 在容器组“app-with-ssl”中无法访问。请检查 图像和注册表凭据。

我尝试运行上面的命令,并为其提供注册表的凭据,如下所示:

az container create --resource-group my-resource-group --file deploy-aci.yaml --registry-login-server my-server.azurecr.io --registry-username my-registry --registry-password my-password

我还尝试将图像拉到本地计算机上,这没有问题。该图像是公开可用的(基本定价计划,我无法将其设置为私人),并且我检查了我的凭据是否正确。知道我还遗漏了什么吗?

azure deployment containers azure-cli azure-container-registry
2个回答
0
投票

我相信它需要图像的完整 URL。因此,在

deploy-aci.yaml
中替换这一行

image: my-registry/my-image:latest

用类似的东西

image: mcr.microsoft.com/my-registry/my-image:latest

0
投票

这是你自己的azure容器注册表,对吗?

您是否尝试过这样登录?:https://learn.microsoft.com/en-us/azure/container-registry/container-registry-authentication?tabs=azure-cli

我也遇到过这个错误 - 不久前 - 直接登录后已修复。

您是否尝试过创建具有较少设置/属性的容器?

您是否尝试过只创建一个容器?

你确定“音量”后面的部分没有错误吗?

© www.soinside.com 2019 - 2024. All rights reserved.