gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 07:39:58 26 4
gpt4 key购买 nike

我目前正在测试 Azure,并尝试部署我自己的 docker 镜像。该镜像托管在我的虚拟服务器上的注册表中。注册表使用端口 5000。当我尝试为 .yaml 文件提供正确的 imageRegistryCredentials 时,它失败了。

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

az container create -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.

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

最佳答案

当你从私有(private)容器注册表创建Azure容器实例时,那么容器注册表应该可以从Internet访问,至少Azure可以访问它,而不仅仅是可以从私有(private)网络访问。

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

如果您还有其他问题,请告诉我。我很高兴提供更多帮助。

更新

imageRegistryCredentials属性的定义在Azure Template中,在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容器实例目前不支持带证书的私有(private)registry,只支持带用户名和密码的私有(private)registry。也许将来会支持,但现在不行。所以如果你想使用私有(private)注册表,那么你需要删除证书authenticate。

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

关于azure - 配置 Azure ContainerInstance 以使用自托管注册表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55540305/

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