简体   繁体   English

如何登录Azure中的容器?

[英]How to log into container in Azure?

I deploy a docker image inside Azure Container Instance.我在 Azure 容器实例中部署了一个 docker 图像。 The application itself will write some log into the file.应用程序本身会将一些日志写入文件。 Is there some way I can log into the container to view these logs?有什么方法可以登录容器查看这些日志吗?

az container exec --resource-group <group-name> --name <container-group-name> --exec-command "<command>"

https://learn.microsoft.com/en-us/azure/container-instances/container-instances-exec https://learn.microsoft.com/en-us/azure/container-instances/container-instances-exec

You could also create a context with docker and then use docker commands.您还可以使用 docker 创建上下文,然后使用 docker 命令。

docker context create aci myacicontext
docker context use myacicontext
docker logs <CONTAINER_ID>
docker exec -t <CONTAINER_ID> COMMAND

https://docs.docker.com/cloud/aci-integration/#create-an-aci-context https://docs.docker.com/cloud/aci-integration/#create-an-aci-context

Have found the answer.已经找到答案了。

az container logs  --name your-container-name --resource-group your-resource-group-name

or或者

az container exec --name your-container-name --resource-group your-resource-group-name --exec-command "cat /home/yourname/xxx.log"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将 AKS 应用程序集群、节点、Pod、容器指标发送到 Log Analytics 工作区,以便在 Azure 监控中可用? - How to send the AKS application Cluster, Node, Pod, Container metrics to Log Analytics workspace so that it will be available in Azure Monitoring? Azure Log Analytics 工作区中的容器实例自定义日志 - Azure Container Instance Custom Log in Log Analytics Workspace 如何在 kube.netes 中停止 I/O 日志容器 - how to stop I/O log container in kubernetes 如何将自定义属性从 Azure Function 记录到日志分析? - How to log custom properties from Azure Function to Log analytics? 如何从 Azure 容器应用服务使用 Azure ACR 进行身份验证 - How to authenticate with Azure ACR from Azure container app service 如何将 Azure Front Door 与 Azure 容器应用程序一起使用? - How to use Azure Front Door with Azure Container Apps? 如何在 azure 容器实例中运行 Azuredevops buildagent - How to run Azuredevops buildagent in azure container instance 如何在 Linux 容器内重启 Azure Function? - How to restart an Azure Function inside a Linux container? 如何更改 Azure 函数中的日志级别 - How to change log level in Azure Functions 如何在 azure 容器应用程序上托管 arm64 docker 容器 - How to host a arm64 docker container on azure container apps
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM