How to use grafana-cli on docker installed Grafana? How to use grafana-cli on docker installed Grafana? docker docker

How to use grafana-cli on docker installed Grafana?


If you meant running Grafana with some plugins installed, you can do it by passing a list of plugin names to a variable called GF_INSTALL_PLUGINS.

sudo docker run -d -p 3000:3000 -e "GF_INSTALL_PLUGINS=gridprotectionalliance-openhistorian-datasource,gridprotectionalliance-osisoftpi-datasource" grafana/grafana

I did this on Grafana 4.x

Installing plugins for Grafana 3 "or above"


For a full automatic setup of your Grafana install with the plugins you want I would follow Ricardo's suggestion. Its much better if you can configure your entire container as wanted in a single hit like that.

However if you are just playing with the plugins and want to install some manually, then you can access a shell on the running docker instance from the host.

host:~$ docker exec -it grafana /bin/bash

... assuming you named the docker container "grafana" otherwise you will need to substitute the given container name. The shell prompt that returns will allow you to run the standard

root@3e04b4578ebe:/# grafana-cli plugins install ....

Be warned that it may tell you to run service grafana-server restart afterwards. In my experience that didn't work (Not sure it runs as a traditional service in the container). However if you exit the container, and restart the container from the host...

host:~$ docker restart grafana

That should restart the grafana service and your new plugins should be in place.


Grafana running in docker container

Docker installed on Windows 10

Test: command to display grafana-cli help

c:\>docker exec -it grafana grafana-cli --help

Tested with a version: Version 6.4.4 November 6, 2019