Docker Community Forums

Share and learn in the Docker community.

JSON Logging Driver Compression Broken?

I’m trying to get the json logging driver to compress rotated files by including the compress key in log-opts of /etc/docker/daemon.json. The file looks like this:

{
  ...
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m",
    "max-file": "10",
    "compress": "true"
  }
}

After editing the file, I ran the following console commands and got the following outputs:

$: docker-compose down
# containers all go down without problems.
$: systemctl daemon-reload
$: systemctl restart docker
# Output:
# Job for docker.service failed because the control process exited with error code.
# See "systemctl status docker.service" and "journalctl -xe" for details.

The output of systemctl status docker.service is pretty unhelpful. It reports (breif version:)

docker.service: Failed with result 'exit-code'.

and journalctl -xe gives me:

-- Unit docker.service has failed
--
-- The result is RESULT.

If I remove the compress key-value pair from daemon.json, everything runs just fine. Given that the result code reporting above looks suspiciously broken, I’m willing to bet I’ve run across a bug.

Before I create an issue, I wanted to ping the community to see if anyone has had a similar experience and resolved it. Any help is greatly appreciated!

I am facing exactly the same issue.
Did you get any leads on this?

I ended up using the journald log driver instead. If you’re on linux it maybe a worthwhile option to look into since you get much greater control over rotation (time and size based) and compression.

OOooo I just noticed that the version of docker that I’m tied to using a bit old (18.03.1-ce) .@alankrita, which version are you experiencing it with?

I am using 17.12.1-ce. Not sure if this is not the issue in higher versions.
and yes, as an alternative i mounted the application logs instead of using the container logs.