I solved this issue as follows and successfully tested it in:
Unraid 6.9.2
Unraid 6.10.0-rc1
Add this to /boot/config/go (by Config Editor Plugin):
# -------------------------------------------------
# RAM-Disk for Docker json/log files
# -------------------------------------------------
# create RAM-Disk on starting the docker service
sed -i '/^ echo "starting \$BASE ..."$/i \
# move json/logs to ram disk\
rsync -aH --delete /var/lib/docker/containers/ ${DOCKER_APP_CONFIG_PATH%/}/containers_backup\
mount -t tmpfs tmpfs /var/lib/docker/containers\
rsync -aH --delete ${DOCKER_APP_CONFIG_PATH%/}/containers_backup/ /var/lib/docker/containers\
logger -t docker RAM-Disk created' /etc/rc.d/rc.docker
# remove RAM-Disk on stopping the docker service
sed -i '/^ # tear down the bridge$/i \
# backup json/logs and remove RAM-Disk\
rsync -aH --delete /var/lib/docker/containers/ ${DOCKER_APP_CONFIG_PATH%/}/containers_backup\
umount /var/lib/docker/containers\
rsync -aH --delete ${DOCKER_APP_CONFIG_PATH%/}/containers_backup/ /var/lib/docker/containers\
logger -t docker RAM-Disk removed' /etc/rc.d/rc.docker
# Automatically backup Docker RAM-Disk
sed -i '/^<?PHP$/a \
$sync_interval_minutes=30;\
if ( ! ((date('i') * date('H') * 60 + date('i')) % $sync_interval_minutes) && file_exists("/var/lib/docker/containers")) {\
exec("mkdir /var/lib/docker_bind");\
exec("mount --bind /var/lib/docker /var/lib/docker_bind");\
exec("rsync -aH --delete /var/lib/docker/containers/ /var/lib/docker_bind/containers");\
exec("umount /var/lib/docker_bind");\
exec("rmdir /var/lib/docker_bind");\
exec("logger -t docker RAM-Disk synced");\
}' /usr/local/emhttp/plugins/dynamix/scripts/monitor
Optional: Limit the Docker LOG size to avoid using too much RAM:
Reboot server
Notes:
By this change /var/lib/docker/containers, which contains only status and log files, becomes a RAM-Disk and therefore avoids wearing out your SSD and allows a permanent sleeping SSD (energy efficient)
It automatically syncs the RAM-Disk every 30 minutes to your default appdata location (for server crash / power-loss scenarios). If container logs are important to you, feel free to change the value of "$sync_interval_minutes" in the above code to a smaller value to sync the RAM-Disk every x minutes.
If you like to update Unraid OS, you should remove the change from the Go File until it's clear that this enhancement is still working/needed!
Your Reward:
After you enabled the docker service you can check if the RAM-Disk has been created (and its usage):
Screenshot of changes in /etc/rc.d/rc.docker
and /usr/local/emhttp/plugins/dynamix/scripts/monitor
I followed this and now my log memory constantly shows 100%. Is this something to be concerned about?
EDIT: this is unrelated, looks like nginx is running away with the logs
[6.8.3] Unnecessary overwriting of JSON-files in docker.img every 5 seconds
in Stable Releases
Posted · Edited by mehappy
I followed this and now my log memory constantly shows 100%. Is this something to be concerned about?
EDIT: this is unrelated, looks like nginx is running away with the logs
I found another topic (unsolved) that is about this issue: https://forums.unraid.net/topic/86114-nginx-running-out-of-shared-memory/