I created this logrotate rule to rotate the docker json log files:<p><pre><code>  &#x2F;var&#x2F;lib&#x2F;docker&#x2F;containers&#x2F;*&#x2F;*-json.log {
      copytruncate
      rotate 2
      size 40M
      missingok
      nocreate
      nocompress
  }
</code></pre>
But for most services I still mount a log dir and redirect stdout and stderr to a file manually, since neither the json log format nor that directory structure are particularly convenient for my purposes.<p>More recent docker releases have added other logging drivers, and added options to the &quot;json-file&quot; logging driver for &quot;max-size&quot; and &quot;max-file&quot;, which sounds appropriate, but that came after I worked around the problem and I haven&#x27;t upgraded yet.