gpt4 book ai didi

Azure 容器实例不显示日志

转载 作者:行者123 更新时间:2023-12-03 03:27:27 24 4
gpt4 key购买 nike

我有一个从自定义容器镜像部署的 Azure 容器实例 (ACI),并将其存储在 Azure 容器注册表 (ACR) 中。

容器镜像运行一个简单的 Python 脚本(后台工作程序,无公开端口),该脚本使用 Docker Desktop 在我的 Windows 11 系统上本地运行。该脚本使用 print() 函数打印一些日志文本,以便我可以看到应用程序内部发生了什么。

当 ACI 启动容器时,它不会在容器事件选项卡下显示任何事件,并且在日志选项卡下也不显示任何日志选项卡。

enter image description here

但是,容器正在实际运行,我可以使用连接选项卡在容器中打开交互式 shell。我可以运行 ps -aux 并看到 Python 脚本(入口点)实际上正在运行。

enter image description here

问题:即使容器已成功启动并运行,为什么事件和日志未填充到 Azure 容器实例服务中?

注意:我正在部署到美国中西部 Azure 区域。

最佳答案

under the container Events tab, and it also doesn't show any logs, under the Logs tab.

我们在 Azure CLI 中还有另一个选项来获取 Azure 容器实例 的日志。

在 Azure 门户中,打开 Cloud shell

enter image description here

Azure Cloudshell - Bash 中运行以下命令。

az container logs --name YourContanerInstanceName --resource-group YourRGName

日志输出:

enter image description here

enter image description here

要获取事件,请使用以下 CLI 命令。

az container show --resource-group YourRGName --name YourContanerInstanceName

事件输出:

enter image description here

enter image description here

Why are the Events and Logs not populating in the Azure Container Instances service, even though the container is successfully up and running?

另请参阅Options to View Container Logs .

引用来自 MSDoc Container logsDiagnostic Events .

关于Azure 容器实例不显示日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75394064/

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