Python中文
首页
教程
问答
标签
搜索
登录
注册
同时查看所有docker容器的日志
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我目前在后端使用docker,当我第一次使用docker启动后端时</p> <pre><code>docker-compose up </code></pre> <p>我一次得到所有4个Docker的日志输出,这样我就可以看到当请求进来时它们是如何相互作用的。看起来像这样,一个从nginx到couchdb的请求</p> <p><img src="https://i.stack.imgur.com/S6Ldf.png" alt="http://i.imgur.com/E4GQ43F.png"/></p> <p>现在的问题是,我正在GCE上运行负载平衡,当一个新的虚拟机启动时,它会自动启动docker并正常运行,我希望能够访问负载平衡的虚拟机并查看实时日志,但我无法让docker允许我使用这种风格的日志,它给了我正常的全白色字体,没有它来自哪里的标签</p> <p>使用</p> <pre><code>docker events </code></pre> <p>不做任何操作,它不会返回任何信息</p> <p>tldr;与运行“docker compose up”时获得的日志输出相同,获取视图的最佳方式是什么</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>您可以查看所有正在运行的容器的日志</p> <pre><code>docker ps -q | xargs -L 1 docker logs </code></pre> <p>理论上,如果xargs与<code>-P <count></code>一起运行,则这可能也适用于<code>--follow</code>,其中计数高于正在运行的容器数</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
我想从用户inpu创建一个类的实例
6 回答
我想从用户导入值,为此
6 回答
我想从用户那里得到一个整数输入,然后让for循环遍历该数字,然后调用一个函数多次
10 回答
我想从用户那里收到一个列表,并在其中执行一些步骤,然后在步骤完成后将其打印回来,但它没有按照我想要的方式工作
9 回答
我想从用户那里获取输入,并将值传递给(average=dict[x]/6),然后在那里获取resu
3 回答
我想从第一个列表中展示第一个词,然后从第二个列表中展示十个词,以此类推- Python
1 回答
我想从第一个空lin开始解析文本文件
5 回答
我想从简历、简历中提取特定部分
6 回答
我想从给定字典(python)的字符串中删除\u00a9、\u201d和类似的字符。
9 回答
我想从给定的网站Lin下载许多文件扩展名相同的Wget或Python文件
10 回答
我想从网上搜集一些关于抵押贷款的数据
8 回答
我想从网站上删除电子邮件地址
8 回答
我想从网站上读取数据该网站包含可下载的文件,然后我想用python脚本把它发送给oracle如何?
2 回答
我想从网站中提取数据,然后将其显示在我的网页上
6 回答
我想从网页上提取统计数据。
8 回答
我想从网页上解析首都城市,并在用户输入国家时在终端上打印它们
5 回答
我想从色彩图中删除前n个颜色,而不丢失原始颜色数
4 回答
我想从课堂上打印字典里的键
3 回答
我想从费用表中获取学生上次支付的费用,其中学生id=id
3 回答
我想从较低的顺序对多重列表进行排序,但我无法在一行中生成结果
1 回答