matajaz
September 5, 2017, 1:27pm
1
Hi,
My grafana container is running where there is no internet connectivity.
I would therefore like to install my plugins from the Dockerfile.
I have tried:
RUN /usr/sbin/grafana-cli plugins install vonage-status-panel
Installation looks successful while building the dockerfile but there are no plugins installed.
Not even “/var/lib/grafana/plugins” directory is created.
Step 10 : RUN /usr/sbin/grafana-cli plugins install vonage-status-panel
—> Running in d3d4df4712f2
installing vonage-status-panel @ 1.0.5
from url: https://grafana.com/api/plugins/vonage-status-panel/versions/1.0.5/download
into: /var/lib/grafana/plugins
Installed vonage-status-panel successfully
Restart grafana after installing plugins .
Is it possible to install plugins from Dockerfile?
Br Mathias
1 Like
Yes, it is possible with the GF_INSTALL_PLUGINS environmental variable . Like this:
docker run \
-d \
-p 3000:3000 \
--name=grafana \
-e "GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource" \
grafana/grafana
See https://hub.docker.com/r/grafana/grafana/
matajaz
September 5, 2017, 4:28pm
3
Hello Danielle,
It does not help me to install the plugin at run time.
I need to install the plugin at build time.
Failed to send requesterrorGet https://grafana.com/api/plugins/repo/grafana-clock-panel: dial tcp 127.0.0.1:443: getsockopt: connection refused
Error: ✗ Failed to send request. error: Get https://grafana.com/api/plugins/repo/grafana-clock-panel: dial tcp 127.0.0.1:443: getsockopt: connection refused
NAME:
Grafana cli plugins install - install <plugin version (optional)>
I simulated no connectivity with the following docker parameter:
–add-host grafana.com:127.0.0.1
I need the container fully installed at run time.
Any other ideas?
Br Mathias
Read too fast the first time and missed this important information.
It will be a bit harder then. You will have to download the plugins manually first and create a dockerfile that copies them into the Grafana subdirectory: data/plugins. If you google for it, you might find someone who has done it already.
zhukov
November 16, 2017, 1:22pm
6
The reason you cannot do grafana-cli plugin install is that Dockerfile for grafana use
VOLUME ["/var/lib/grafana", “/var/log/grafana”, “/etc/grafana”]
FROM debian:jessie
ARG DOWNLOAD_URL
RUN apt-get update && \
apt-get -y --no-install-recommends install libfontconfig curl ca-certificates && \
apt-get clean && \
curl ${DOWNLOAD_URL} > /tmp/grafana.deb && \
dpkg -i /tmp/grafana.deb && \
rm /tmp/grafana.deb && \
curl -L https://github.com/tianon/gosu/releases/download/1.10/gosu-amd64 > /usr/sbin/gosu && \
chmod +x /usr/sbin/gosu && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
VOLUME ["/var/lib/grafana", "/var/log/grafana", "/etc/grafana"]
EXPOSE 3000
COPY ./run.sh /run.sh
This file has been truncated. show original
So any changes with /var/lib/grafana will be lost when you build your own Dockerfile using FROM official image.
@daniellee and @matajaz maybe you can be interesting in my solution.
I do the following things:
create non-default plugin dir in /data/grafana/plugins
in my custom Dockerfile install plugin into /data/grafana/plugins
in docker-compose pass environment variable GF_PATHS_PLUGINS=/data/grafana/plugins
Dockerfile
FROM grafana/grafana:4.6.1
RUN mkdir -p /data/grafana/plugins && chown -R grafana:grafana /data/grafana/plugins
RUN grafana-cli --pluginsDir "/data/grafana/plugins" plugins install natel-discrete-panel \
&& grafana-cli --pluginsDir "/data/grafana/plugins" plugins install natel-influx-admin-panel
docker-compose.yml
environment:
- "GF_PATHS_PLUGINS=/data/grafana/plugins"
2 Likes