search

Home  >  Q&A  >  body text

如何不输出docker后台进程的日志到屏幕

默认情况下,service docker startdocker -d,docker后台进程默认会在当前终端输出日志,回车几下又可以获得shell,继续执行其他命令,然而当docker有日志需要输出到屏幕时,会再次进入到日志输出,很不方便。有没有办法在启动docker时指定日志输出的地方?

阿神阿神2781 days ago711

reply all(1)I'll reply

  • PHPz

    PHPz2017-04-21 10:59:21

    The answer is very straightforward:

    docker -d > /path/to/log/file
    

    At the same time you should modify the output of /etc/init.d/docker 的代码,把 start-stop-daemon to also redirect.

    Docker’s default daemon behavior is indeed quite unpleasant.

    reply
    0
  • Cancelreply