【发布时间】:2018-12-03 04:27:06
【问题描述】:
我想通过管道传输在 docker 容器内运行的程序的标准输出,同时将输出保存在 docker 日志(即标准输出)中。
另一个 stackoverflow 问题 (How to pipe stdout while keeping it on screen ? (and not to a output file)) 建议使用 foo | tee /dev/tty | bar,但是当 docker 在非交互模式下运行时这不起作用,因为 /dev/tty 不存在。
这可能吗?
【问题讨论】:
-
foo | tee >(bar)? -
这似乎可以工作,只要我使用 bash 而不是 sh 这很好。随意将此评论更改为答案,以便我可以勾选它