Configure Docker logging driver with Grafana Loki

Apr 06, 2022 · 1 min read · Post a comment

Grafana Loki is a log aggregation tool inspired by Prometheus, or simply put Prometheus for logs. In this tutorial I’m going to show you how to install and configure the Loki logging driver in Docker.


  • Docker
  • Grafana Loki


Step 1. Install the Loki Docker plugin.

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

Step 2. Verify installation.

docker plugin ls


ID             NAME          DESCRIPTION           ENABLED
1e87f2ea1a08   loki:latest   Loki Logging Driver   true

Step 3. Configure the Loki logging driver to be default for all Docker containers. Open or create the /etc/docker/daemon.json file first.

Step 4. Add the following code block:

    "log-driver": "loki",
    "log-opts": {
        "loki-url": "https://<user_id>:<password>@<loki_endpoint>/loki/api/v1/push",
        "loki-batch-size": "400"

Step 5. Restart the Docker service.

systemctl restart docker


Official Docker Driver Client from Grafana Loki documentation. On a side note, follow our official channel on Telegram.