docker logs: configured logging driver does not support reading
docker logs can't read when the driver is none or a remote driver has cache-disabled. Read logs at the destination and recreate the container.
Error response from daemon: configured logging driver does not support readingThe container's logging driver keeps no copy that docker logs can read. There are two cases: the driver is none, or a remote driver such as syslog, gelf or fluentd has its local cache (dual logging) turned off with cache-disabled=true. Past output cannot be recovered from the container, so read it where it was sent and change the settings for the future.
[1] Check the driver and options of that container. What counts is the value the container got when it was created, not the current daemon default.
# docker inspect --format '{{.HostConfig.LogConfig.Type}} {{json .HostConfig.LogConfig.Config}}' web| Output | Meaning |
|---|---|
none {} | logs are kept nowhere |
gelf {"cache-disabled":"true",…} | remote only, local cache off |
gelf {"gelf-address":…} without cache-disabled | cache on, so docker logs should work |
json-file, local, journald | the driver supports reading itself; this error does not appear |
[2] Here is the same driver with and without the cache. On Docker Engine 29.9.2, a container logging to gelf with the default cache could use docker logs; only the one with cache-disabled=true gave the error. Both containers were created with --log-driver gelf --log-opt gelf-address=udp://127.0.0.1:12201, and only the second added --log-opt cache-disabled=true. Each was read with the command below (the ## … lines are section headers added by the test script).
# docker logs <container> 2>&1; echo "exit=$?"## gelf-cache: docker logshello from appexit=0## gelf-cache: driver and optionsgelf {"gelf-address":"udp://127.0.0.1:12201"}## gelf-nocache: docker logsError response from daemon: configured logging driver does not support readingexit=1## gelf-nocache: driver and optionsgelf {"cache-disabled":"true","gelf-address":"udp://127.0.0.1:12201"}The driver and options lines are the output of the docker inspect command from step [1].
As the Docker dual logging page describes, remote drivers get a local cache by default. Defaults: cache-disabled false, cache-max-size 20m, cache-max-file 5, cache-compress true. The none driver gave the same error in the test, with no cache.
[3] Read the logs you need now at their destination. With journald, docker logs works anyway, and you can also query the journal directly:
# journalctl -b CONTAINER_NAME=webFor syslog look at the syslog server's files; for gelf or fluentd, search the receiver (Graylog, Fluentd and so on) by container name or ID. If the driver was none, nothing was kept.
[4] To have docker logs from now on, change the settings and recreate the container. The Docker docs note that existing containers don't pick up a new logging configuration automatically.
# docker inspect web > web-inspect.json# docker rm -f web# docker run -d --name web --log-driver gelf --log-opt gelf-address=udp://192.0.2.10:12201 nginx:stableDrop cache-disabled=true, or if local logs are enough, go back to --log-driver local or the default json-file.
[5] If none or cache-disabled was set as the daemon default (log-driver / log-opts in /etc/docker/daemon.json), edit that file and restart Docker; the new value applies to newly created containers only. Check the current default with:
# docker info --format '{{.LoggingDriver}}'json-fileFor the opposite problem — log files filling the disk — see Docker json-file logs filling the disk: max-size and max-file.