Azure 容器实例在浏览器上不响应 DNS 名称

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

我有本地监听端口 5000 的 docker 镜像。 我已将映像部署到 Azure 容器注册表。

然后我使用以下命令创建了 Azure 容器实例:

az container create --resource-group myResourceGroup --name aci-tutorial-app --image <acrLoginServer>/aci-tutorial-app:v1 --cpu 1 --memory 1 --registry-login-server <acrLoginServer> --registry-username <service-principal-ID> --registry-password <service-principal-password> --dns-name-label <aciDnsLabel> --ports 80

容器创建成功,但浏览器未响应 DNS 名称。日志如下所示。

PS C:\azure\ACIPythonAPI> az container logs --resource-group My-Container-RG --name mycontainer
[2022-01-10 08:33:36 +0000] [18] [INFO] Starting gunicorn 20.1.0
[2022-01-10 08:33:36 +0000] [18] [INFO] Listening at: http://0.0.0.0:5000 (18)
[2022-01-10 08:33:37 +0000] [18] [INFO] Using worker: sync
[2022-01-10 08:33:37 +0000] [25] [INFO] Booting worker with pid: 25

可能出现什么问题? docker中的端口定义不正确?如何排除故障?

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

我在我的环境中进行了测试,它对我来说工作得很好。我正在使用

nginx
图像并推送到容器注册表。

enter image description here

enter image description here

使用最近推送的容器注册表中的图像创建容器实例。我使用与创建容器相同的命令。

enter image description here

建议您使用容器实例的

FDQN
Public IPAddress
在浏览器上点击并能够看到容器实例的响应。

enter image description here


0
投票

与我的问题类似,我将图像文件中的公开端口更新为与天蓝色实例端口类似。它有效


0
投票

我遇到了同样的问题。在您创建的容器内,应用程序正在侦听端口 5000。但是您的容器实例是使用端口 80 创建的,因此它不匹配。在此日期之前,容器映像不支持端口映射

因此,现在请确保容器中的端口与您在容器实例中设置的端口相匹配。

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