14

I have installed grafana via docker.

Is it possible to export and run grafana-cli on my host?

1
  • You need grafana-cli to be used as a command on host so you don't need get inside container everytime? Or you want to it to collect data from host and work on that? Commented Aug 9, 2017 at 5:53

3 Answers 3

16

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"

14

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.

5

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.