配置Azure ContainerInstance以使用自托管注册表

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

我正在测试Azure,我试图部署自己的docker镜像。该映像托管在我的VServer上的注册表中。注册表使用端口5000.当我尝试使用正确的imageRegistryCredentials提供.yaml文件时,它会失败。

Image registry credentials:
- server: my.server.com:5000
  username: me
  password: abc123

az容器创建-g我的组--file myconainer.yaml返回:

The server 'my.server.com:5000' in the 'imageRegistryCredentials' of container group 'MyContainerGroup' is Invalid. 
It should be a valid hostname without protocol.

如果我不提供端口,我无法登录到注册表。我究竟做错了什么?

azure azure-container-instances
1个回答
3
投票

当您从私有容器注册表创建Azure容器实例时,应该从Internet访问容器注册表,至少Azure可以访问它,而不仅仅是可以从专用网络访问。

如果没有,我建议您可以将图像推送到Azure Container Registry,然后从中创建Azure容器实例。它也是一个私人注册表。它有很棒的access control

如果您有更多问题,请告诉我。我很乐意提供更多帮助。

更新

在Azure模板中定义imageRegistryCredentials的属性,它也与yaml文件中的含义相同。它不需要端口,只需要服务器名称。如果添加端口,我可以重新出现你得到的错误。

enter image description here

尝试添加没有端口的注册表服务器名称,如下所示:

apiVersion: 2018-10-01
location: eastus
name: azureContainerGroup
properties:
  containers:
  - name: aci-tutorial-app
    properties:
      image: charlesacr.azurecr.io/nginx:v1
      resources:
        requests:
          cpu: 1
          memoryInGb: 1.5
      ports:
      - port: 80
  osType: Linux
  ipAddress:
    type: Public
    ports:
    - protocol: tcp
      port: '80'
  imageRegistryCredentials:
    - server: charlesacr.azurecr.io
      username: charlesACR
      password: xxxxxxxxxx
tags: null
type: Microsoft.ContainerInstance/containerGroups

更新2

最后,通过测试,我发现Azure容器实例目前不支持带有证书的私有注册表,它只支持使用用户名和密码的私有注册表。也许它将在未来支持,但现在不支持。因此,如果要使用私有注册表,则需要删除证书身份验证。

您可以随时通过以下链接提出反馈:https://feedback.azure.com/forums/602224-azure-container-instances

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