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