unraid/webgui

Docker Log Rotation

Closed this issue · 5 comments

It appears (so far as I can tell) that the docker log rotation is handled via modifying the settings for the docker daemon logging driver. All well and good, but there is a fundamental flaw with this approach.

Any changes to the log rotation settings (Settings - Docker) do not affect any currently installed containers. (https://docs.docker.com/config/containers/logging/json-file/) Effectively this means that the option in the GUI is useless without removing and reinstalling the containers.

Should we:

  1. Keep the status quo, but toss up a warning that the changes will require a container (or docker image) removal and recreation
    or
  2. Only allow changes to the log rotation settings when the docker image does not exist. Combine this with a sane default of 50M or 100M limit instead of the current unlimited
    or
  3. When starting containers automatically add on to the extra parameters (as an example) --log-opt max-size=50m --log-opt max-file=1

Option 3 seems the obvious choice, but since full docker run commands are only issued when editing a container, then it doesn't work either consistently. Because of this, option 2 seems to be the best.

I did a check and see that at some point (reason unknown) the LOG settings disappeared from the daemon startup script. This explains why it isn't working (anymore).

I made an update to correct this.

Are you also going to be adding in some text or something to warn that changes to the settings only affect new container installs, and existing containers aren't affected? This is a docker limitation, not unRaid https://docs.docker.com/config/containers/logging/json-file/ I would also recommend that sane defaults be set for the log size, not the current unlimited.

I am thinking to automatically include the LOG settings in the 'run' command (your option 3), this would ensure all containers use the same LOG settings when the docker daemon is started. There is no dependency on editing or not of a container.

That solution has the same problem as the status quo (assuming you fix it). Any changes to the log settings won't affect an existing container.

docker run commands aren't issued when starting a previously installed container. Rather, docker start commands are issued.

TBH, I still think the best solution is only to allow changes to log settings when there is no image present. But, if the default setting for logging changes to 50Meg and 1 file, then we really don't even need the log options. Anyone who needs a larger log size can manually put the entry into ExtraParams, and those who don't know what they are doing will never miss it at all. Having the current unlimited default and how the docker system works with regards to changes to this setting is troublesome on the forum.

Not my ideal solution on #434, but it will do. Closing issue.