Skip to content

Logging drivers and log rotation

Select an icon to see what it is.

Step 2 of 6

The driver is chosen per container

--log-driver and --log-opt end up in HostConfig.LogConfig of the create request. The default driver is json-file, which has no size limit unless you set one. Here max-size and max-file turn rotation on.

$ docker run -d --log-driver json-file --log-opt max-size=10m --log-opt max-file=3 nginx

POST /v1.45/containers/create

{
"Image": "nginx"
"HostConfig": {
"LogConfig": {
"Type": "json-file"
"Config": {
"max-size": "10m"
"max-file": "3"
}
}
}
}