同时查看所有Docker容器的日志 [英] View logs for all docker containers simultaneously

查看:83
本文介绍了同时查看所有Docker容器的日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用docker作为后端,以及我第一次使用

I currently use docker for my backend, and when I first start them up with

docker-compose up

我一次获得所有4个docker的日志输出,因此我可以看到它们在请求进入时是如何交互的.看起来像这样,一个请求从nginx到沙发床

I get log outputs of all 4 dockers at once, so I can see how they are interacting with each other when a request comes in. Looking like this, one request going from nginx to couchdb

现在的问题是,我在具有负载平衡功能的GCE上运行,当新VM启动时,它会自动启动dockers并正常运行,我希望能够访问负载平衡的VM并查看实时日志,但我无法让docker允许我使用这种样式,当我使用日志时,它为我提供了普通的全白字体,没有标签来源.

The issue is now that I am running on GCE with load balancing, when a new VM spins up, it auto starts the dockers and runs normally, I would like to be able to access a load balanced VM and view the live logs, but I can not get docker to allow me this style, when I use logs, it gives me normal all white font with no label of where it came from.

使用

docker events  

不执行任何操作,不会返回任何信息.

does nothing, it won't return any info.

tldr;获取视图的最佳方法是什么,与运行"docker-compose up"时获得的日志输出相同

tldr; what is the best way to obtain a view, same as the log output you get when running "docker-compose up"

推荐答案

如果使用docker-compose,则使用

If using docker-compose, you use

docker-compose logs --tail=0 --follow

代替

docker logs --tail=0 --follow

这将获得我最初想要的输出.

This will get the output I was originally looking for.

这篇关于同时查看所有Docker容器的日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆