• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Input enable log rotation for docker container

johnrdorazio

Basic Pleskian
Currently I believe there is no way to enable log rotation for docker containers, using the provided docker plugin for Plesk.

I tried creating the file /etc/docker/daemon.json with these values:


JSON:
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  }
}

And I restarted the docker service. Either it's not picking up the log-opts, or perhaps I need to re-create my container (rather than just restart it).

In any case it would be nice to be able to set these options both on the docker service level, and perhaps on the container level, directly in the Plesk Docker interface.
 
I have now tested that after re-creating the container, it is now correctly rotating the log file as it reaches the 10M limit. So the /etc/docker/daemon.json file is working correctly. It's not enough to restart the docker service, it is necessary to re-create the docker containers.
 
Back
Top