github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/docs/sources/clients/docker-driver/_index.md (about)

     1  ---
     2  title: Docker driver
     3  weight: 40
     4  ---
     5  # Docker Driver Client
     6  
     7  Grafana Loki officially supports a Docker plugin that will read logs from Docker
     8  containers and ship them to Loki. The plugin can be configured to send the logs
     9  to a private Loki instance or [Grafana Cloud](https://grafana.com/oss/loki).
    10  
    11  > Docker plugins are not yet supported on Windows; see the
    12  > [Docker Engine managed plugin system](https://docs.docker.com/engine/extend) documentation for more information.
    13  
    14  Documentation on configuring the Loki Docker Driver can be found on the
    15  [configuration page](./configuration).
    16  
    17  If you have any questions or issues using the Docker plugin feel free to open an issue in this [repository](https://github.com/grafana/loki/issues).
    18  
    19  ## Installing
    20  
    21  The Docker plugin must be installed on each Docker host that will be running
    22  containers you want to collect logs from.
    23  
    24  Run the following command to install the plugin:
    25  
    26  ```bash
    27  docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions
    28  ```
    29  
    30  To check installed plugins, use the `docker plugin ls` command. Plugins that
    31  have started successfully are listed as enabled:
    32  
    33  ```bash
    34  $ docker plugin ls
    35  ID                  NAME         DESCRIPTION           ENABLED
    36  ac720b8fcfdb        loki         Loki Logging Driver   true
    37  ```
    38  
    39  Once the plugin is installed it can be [configured](./configuration).
    40  
    41  ## Upgrading
    42  
    43  The upgrade process involves disabling the existing plugin, upgrading, then
    44  re-enabling and restarting Docker:
    45  
    46  ```bash
    47  docker plugin disable loki --force
    48  docker plugin upgrade loki grafana/loki-docker-driver:latest --grant-all-permissions
    49  docker plugin enable loki
    50  systemctl restart docker
    51  ```
    52  
    53  ## Uninstalling
    54  
    55  To cleanly uninstall the plugin, disable and remove it:
    56  
    57  ```bash
    58  docker plugin disable loki --force
    59  docker plugin rm loki
    60  ```
    61  
    62  # Know Issues
    63  
    64  The driver keeps all logs in memory and will drop log entries if Loki is not reachable and if the quantity of `max_retries` has been exceeded. To avoid the dropping of log entries, setting `max_retries` to zero allows unlimited retries; the drive will continue trying forever until Loki is again reachable. Trying forever may have undesired consequences, because the Docker daemon will wait for the Loki driver to process all logs of a container, until the container is removed. Thus, the Docker daemon might wait forever if the container is stuck.
    65  
    66  Use Promtail's [Docker target](../promtail/configuration/#docker) or [Docker service discovery](../promtail/configuration/#docker_sd_config) to avoid this issue.