jakobklemm Posted March 8, 2023 Share Posted March 8, 2023 I'm trying to setup Grafana Loki so that it is able to ingest Docker logs. The container is running without problems. I have installed the Docker Plugin as specified in the Loki docs, but I'm unable to configure the logging backend. The file "/etc/docker/daemon.json" gets overwritten on every restart. Has anyone actually gotten Loki to work on unRaid? The only related post I was able to find was this one: and I find it hard to believe that no one else has tried running Loki on unRaid or encountered this problem. Quote Link to comment
itimpi Posted March 8, 2023 Share Posted March 8, 2023 15 minutes ago, jakobklemm said: The file "/etc/docker/daemon.json" gets overwritten on every restart. Assuming that is the location within the container, have you tried mapping it to a location outside the container? Quote Link to comment
jakobklemm Posted March 8, 2023 Author Share Posted March 8, 2023 No, this is about a system wide log configuration for docker, that requires that specific file, which gets overwritten by unRaid at startup. Quote Link to comment
itimpi Posted March 8, 2023 Share Posted March 8, 2023 1 minute ago, jakobklemm said: No, this is about a system wide log configuration for docker, that requires that specific file, which gets overwritten by unRaid at startup. If you want anything to survive a reboot you need to have a copy on the flash drive that you reinstate as part of the startup sequence. Quote Link to comment
jakobklemm Posted March 8, 2023 Author Share Posted March 8, 2023 I've just tried adding cp /boot/config/daemon.json /etc/docker/daemon.json to the file /boot/config/go but that didn't seem to work. Would you be able to link me a resource on how to execute specific commands on startup before docker gets started? Quote Link to comment
itimpi Posted March 8, 2023 Share Posted March 8, 2023 3 minutes ago, jakobklemm said: I've just tried adding cp /boot/config/daemon.json /etc/docker/daemon.json to the file /boot/config/go but that didn't seem to work. Would you be able to link me a resource on how to execute specific commands on startup before docker gets started? That should work (although it might be necessary to reset permissions). Quote Link to comment
jakobklemm Posted March 9, 2023 Author Share Posted March 9, 2023 Just a quick update: The script should work, but the entire /etc/docker folder actually only gets created when the docker service is started, so the script also has to make the directory before copying the file. (I also realized that this entire approach doesn't really work for my use case at the moment because I have Loki running in a dedicated network to which the unRaid host doesn't have access (I'm aware of the setting to enable it, but that is broken and the workaround is a little to sketchy for my taste), so I'll try to work with a different logging solution. ) Quote Link to comment
L0rdRaiden Posted June 1, 2023 Share Posted June 1, 2023 @jakobklemm Have you found a solution? Have you tried specifying the log driver in the docker run/compose instead on the file like explained here? https://linuxblog.xyz/posts/grafana-loki/ How did you installed the driver? like this? "docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions" Does this survive to reboots? Quote Link to comment
yams Posted August 9, 2023 Share Posted August 9, 2023 Hello! I am facing the same issues you are. To be able to push the log files to loki the file `/etc/docker/daemon.json` needs to be edited to include { "log-driver": "loki", "log-opts": { "loki-url": "http://localhost:3100/loki/api/v1/push", "loki-batch-size": "400" } However when I restart the docker service with `/etc/rc.d/rc.docker stop` and `/etc/rc.d/rc.docker start` an error gets logged to `/var/log/docker.log` showing unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives don't match any configuration option: loki-url, loki-batch-size I have the docker driver installed (installed using `docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions`) and verified using `docker plugin ls` Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.