8

The docker docs said:

To configure the Docker daemon to default to a specific logging driver, set the value of log-driver to the name of the logging driver in the daemon.json file, which is located in /etc/docker/ on Linux hosts or C:\ProgramData\docker\config\ on Windows server hosts. Note that you should create daemon.json file, if the file does not exist. The default logging driver is json-file. ...

enter image description here


BUT, WHY? Why on CentOS 7, it default use journald? I never specify log-driver in my docker-compose.yml

enter image description here

1 Answer 1

3

Have a look into /etc/sysconfig/docker.

You might find among the list of options, the --log-driver being set to journald:

OPTIONS='... --log-driver=journald ...'

Either delete the --log-driver=journald and it will default to json-file, or chose another logging driver that fits your needs.

Reload the daemon and check if the problem persists:

systemctl daemon-reload && systemctl restart docker
3
  • 2
    So, who changed the default behavior?
    – huang
    Commented Aug 8, 2020 at 13:41
  • I do not have a CentOS installed, neither I know how the docker was exactly installed in your context, to reproduce and trace that, but the idea is that your SystemD service unit is loading the config from that file, and that file is setting the --log-driver=journald Commented Aug 8, 2020 at 14:04
  • 1
    I install docker & docker-compose by yum install docker docker-compose. And I make it auto start at boot by systemctl enable docker.
    – huang
    Commented Aug 8, 2020 at 15:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.