Save docker-compose logs to a file

后端 未结 5 555
情歌与酒
情歌与酒 2020-12-12 23:57

I have unit tests running on my build server and would like to capture the log results for analysis when something fails. I have yet to find a way to redirect the output of

5条回答
  •  隐瞒了意图╮
    2020-12-13 00:33

    I am not sure what you are trying to achieve. Are you trying to reproduce

    docker-compose logs > logs.txt
    

    within the compose file as an instruction? Or is your issue that the redirect does not "catch" the whole output?

    In the later, you can do:

    docker-compose logs --no-color >& logs.txt
    

    Or

    docker-compose logs --no-color |& tee logs.txt
    

    to both see the logs on the terminal and dump it to a file at the same time.

提交回复
热议问题