How to Not Output Log of docker Background Process to Screen

  docker, question

By default,service docker startOrdocker -d, the docker background process will output logs at the current terminal by default, and the shell can be obtained after entering a few times to continue executing other commands. However, when the docker has logs to output to the screen, it will enter the log output again, which is inconvenient. Is there any way to specify where the log is output when the docker is started?

The answer is straightforward:

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

At the same time, you should revise it./etc/init.d/dockerThe code of, putstart-stop-daemonThe output of is also redirected.

Docker’s default daemon behavior is really annoying.