Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Docker Loki PLugin

Featured Replies

Hi all, 

 

has anyone tried to add the loki docker plugin?  https://grafana.com/docs/loki/latest/clients/docker-driver/configuration/

 

I have installed it using

 

Quote

docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions

 

i can see the plugin listed 

 

Quote

root@Tower:/mnt/user/appdata/loki# docker plugin ls
ID             NAME          DESCRIPTION           ENABLED
d18f5eaea7c6   loki:latest   Loki Logging Driver   true

 

 

per the instructions, i need to edit file: /etc/docker/daemon.json 

 

nano /etc/docker/daemon.json

My file currently contains the following: 

Quote

{
    "runtimes": {
        "nvidia": {
            "path": "/usr/bin/nvidia-container-runtime",
            "runtimeArgs": []
        }
    }
}


 

I've tried to merge the config then disable and enable docker, however, i just get errors

 

Merged: 

Quote

{
    "runtimes": {
        "nvidia": {
            "path": "/usr/bin/nvidia-container-runtime",
            "runtimeArgs": []
        }
    },
    "debug" : true,
    "log-driver": "loki",
    "log-opts": {
        "loki-url": "http://host.docker.internal:3100/loki/api/v1/push"
    }
}

 

 

Error:

 

Quote

Warning: stream_socket_client(): unable to connect to unix:///var/run/docker.sock (No such file or directory) in /usr/local/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php on line 693
Couldn't create socket: [2] No such file or directory
Warning: Invalid argument supplied for foreach() in /usr/local/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php on line 877

 

 

Im guessing my json is badly formed and i've merged the changes incorreclty 

 

cheers!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • 4 weeks later...

I have the same exact problem!

  • 2 months later...

I've been fumbling around at this for a while and I will say to make sure when trying to set this up you do not have "Docker LOG rotation" enabled in the Unraid Docker settings.

The issue is that when you add this config docker has `log-opts` passed in as both flags (at runtime by the docker service `/etc/rc.d/rc.docker`) and in the file you've updated.

 

The error you are showing is that the docker daemon failed to start and as a result the UI wont work.

  • 1 year later...
On 3/18/2022 at 9:05 AM, absent said:

I've been fumbling around at this for a while and I will say to make sure when trying to set this up you do not have "Docker LOG rotation" enabled in the Unraid Docker settings.

The issue is that when you add this config docker has `log-opts` passed in as both flags (at runtime by the docker service `/etc/rc.d/rc.docker`) and in the file you've updated.

 

The error you are showing is that the docker daemon failed to start and as a result the UI wont work.

Wow thanks man. I was banging my head into the wall for this. I've got a script setup on array start now:
 

#!/bin/bash

DAEMON_CONFIG="/etc/docker/daemon.json"
NEW_CONFIG='{ "log-driver": "loki", "log-opts": { "loki-url": "http://localhost:3100/loki/api/v1/push", "loki-batch-size": "400" } }'

update_config() {
    jq --argjson newConfig "$NEW_CONFIG" '. += $newConfig' "$DAEMON_CONFIG" > tmp.$$ && mv tmp.$$ "$DAEMON_CONFIG"
}

if [ -f "$DAEMON_CONFIG" ]; then
    update_config
else
    echo "$NEW_CONFIG" > "$DAEMON_CONFIG"
fi

/etc/rc.d/rc.docker stop
while pgrep -x docker > /dev/null; do sleep 1; done
/etc/rc.d/rc.docker start

Let's see how it will work over time.
At least docker is starting again :).

Next issue, is that all containers need to be recreated, for them to actually run their logs through loki. Maybe if I make sure loki gets created first. It will work properly.

Edited by Kees Fluitman

  • 11 months later...

I added the following line to `/boot/config/docker.cfg`, and restarted the docker daemon with `/etc/rc.d/rc.docker restart`.

 

DOCKER_OPTS="--log-driver=loki --log-opt loki-url=http://localhost:3100/loki/api/v1/push --log-opt loki-batch-size=400"

 

and confirmed the setting was picked up using this:

 

$ ps aux | grep -i /usr/bin/dockerd
root  ... /usr/bin/dockerd -p /var/run/dockerd.pid --log-opt max-size=50m --log-opt max-file=1 --log-level=fatal --log-driver=loki --log-opt loki-url=http://localhost:3100/loki/api/v1/push --log-opt loki-batch-size=400 --storage-driver=btrfs

 

I don't know if `DOCKER_OPTS` will survive reboots though.

 

I found logs in Grafana for some containers, but not others, but then found the container needs to be recreated (i.e. not just restarted) for the log-driver to changed. Does anyone know of a nice way of doing this? (I'm too lazy to do it container by container myself, so hoping regular container updates will do it 😂).

 

You can see the currently configured log-driver per container using this:

docker inspect <ContainerName> | jq '.[].HostConfig.LogConfig'

 

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.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.