Docker Error Guide: 'unknown log opt' for the configured log driver
Fix Docker's 'unknown log opt <opt> for <driver> log driver' error: match --log-opt keys to the selected --log-driver and use options the driver supports.
- #docker
- #troubleshooting
- #errors
- #logging
Stuck on this Docker with AI error? Get the free incident triage checklist
A one-page PDF — the exact steps to isolate, fix, and verify a production error like this one. No spam, unsubscribe anytime.
Exact Error Message
$ docker run --log-driver json-file --log-opt syslog-facility=daemon nginx
docker: Error response from daemon: unknown log opt 'syslog-facility' for json-file log driver.
You will see the same class of error with other driver/option mismatches, for example:
docker: Error response from daemon: unknown log opt 'max-size' for syslog log driver.
docker: Error response from daemon: error creating logging driver "jsonfile": no such log driver.
What It Means
Every Docker logging driver accepts only its own set of --log-opt keys. When you pass an option that the selected --log-driver does not recognize, the daemon rejects the container at creation time with unknown log opt '<opt>' for <driver> log driver. Nothing starts, because logging is configured before the container process launches.
This is a validation error, not a runtime failure. Docker is telling you the combination of driver and option is invalid: the option might be perfectly valid for a different driver. For example, max-size belongs to json-file and local, while syslog-facility belongs to syslog and journald. Mixing them across drivers triggers the error.
Common Causes
- Passing a
json-file/localrotation option (max-size,max-file) to a driver that does not rotate, likesyslogornone. - Passing a
syslogoption (syslog-address,syslog-facility,tagformatting) while the driver isjson-file. - A daemon-wide default driver in
/etc/docker/daemon.jsonconflicting with per-container--log-optflags. - A typo in the driver name (
jsonfileinstead ofjson-file) producingno such log driver. - Copying a Compose
logging:block between services that use different drivers. - Using an option that only exists in a newer or older Docker version than the one you are running.
Diagnostic Commands
Check the current default logging driver and its configured options:
docker info --format 'Log Driver: {{.LoggingDriver}}'
cat /etc/docker/daemon.json
Inspect a running or failed container to see the driver and options it was given:
docker inspect --format '{{.HostConfig.LogConfig.Type}} {{json .HostConfig.LogConfig.Config}}' <container>
List which options a driver supports by consulting the daemon version:
docker version --format '{{.Server.Version}}'
Reproduce with a minimal container to isolate the offending option:
docker run --rm --log-driver json-file --log-opt max-size=10m hello-world
Step-by-Step Resolution
-
Identify the driver you actually want.
json-fileandlocalare file-based and support size rotation;syslogandjournaldforward to system logging and support facility/tag options. -
Match the option to the driver. For file rotation with
json-fileorlocal, usemax-sizeandmax-file:
docker run -d --log-driver json-file \
--log-opt max-size=10m --log-opt max-file=3 nginx
- For syslog forwarding, use syslog-specific options and drop the rotation keys:
docker run -d --log-driver syslog \
--log-opt syslog-address=udp://10.0.0.5:514 \
--log-opt syslog-facility=daemon \
--log-opt tag="{{.Name}}" nginx
- Fix the driver name if you saw
no such log driver. Valid built-in names includejson-file,local,syslog,journald,fluentd,gelf,awslogs,splunk, andnone:
docker run -d --log-driver json-file nginx # not "jsonfile"
- Reconcile daemon defaults with per-container flags. If
daemon.jsonsets a default driver, per-container--log-optmust be valid for whichever driver ultimately applies:
{
"log-driver": "json-file",
"log-opts": { "max-size": "10m", "max-file": "3" }
}
Then restart the daemon:
sudo systemctl restart docker
- In Compose, keep the
driverand itsoptionsconsistent per service:
services:
web:
image: nginx
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
Prevention
- Pick one logging driver as your standard and set it in
daemon.jsonso per-container overrides are rarely needed. - Keep a reference of which options belong to which driver; do not copy a
logging:block between services without checking the driver. The DevOps AI prompt library has prompts that validate a driver-plus-option pairing before you ship it. - Always set
max-sizeandmax-fileon file-based drivers so container logs cannot fill the disk, a separate but common failure. - Test log configuration with a throwaway
hello-worldrun before rolling it into a real service. - Pin the option set to your Docker server version; verify with
docker versionwhen moving configs between hosts.
Related Errors
error creating logging driver "<name>": no such log driver— the driver name itself is wrong or unavailable.configured logging driver does not support reading—docker logsfails undersyslog/gelf/awslogs, which do not support read-back.json-file logging driver ... disk full— logs filled the disk because rotation options were never set.failed to initialize logging driver: dial tcp ...— a remote driver (fluentd/gelf/splunk) cannot reach its endpoint.
Frequently Asked Questions
Why is max-size invalid for syslog? max-size controls on-disk rotation of local log files, which only file-based drivers (json-file, local) perform. Syslog forwards lines to a remote or system logger and has no local file to rotate.
Where do I find the valid options for a driver? They are documented per driver in the Docker logging driver reference and vary by driver: json-file/local take max-size/max-file, syslog takes syslog-address/syslog-facility/tag, and so on.
Can I use different drivers per container? Yes. The driver and its options are per-container, so long as each container’s --log-opt keys are valid for that container’s --log-driver.
Why does docker logs say the driver does not support reading? Drivers like syslog, gelf, fluentd, and awslogs stream logs elsewhere and cannot serve them back. Use json-file, local, or journald if you need docker logs.
Does a daemon.json default cause this? It can. A default driver set daemon-wide combined with a per-container option for a different driver produces the mismatch. Keep them aligned. For more, see the Docker guides.
Fixed it? Get 500 Docker with AI & DevOps AI prompts — free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.
Did this fix your issue?
Get 500 Battle-Tested DevOps AI Prompts — Free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.