Docker volumes and plugins

When installing a plugin from Dockerfile it works until I use a volume.
In this case, the target /var/lib/grafana directory is mapped on a docker source volume: the target overrides the plugin directory and the installed plugin is vanished.
Anybody else found this issue, and maybe resolved it?

Any example how to replicate your problem will be helpful.

Consider this simple Dockerfile:

FROM grafana/grafana
RUN grafana-cli plugins install grafana-worldmap-panel

build it (say mygrafana) and run without the option -v

docker run -d -p 3000:3000 mygrafana

You’ll se the plugin is installed. But

docker run -d -p 3000:3000 -v <whatever>:/var/lib/grafana mygrafana

no plugin installed

That makes sense. Plugin is installed in the Docker image folder /var/lib/grafana, but you are overwriting it in the container with your host folder, where plugin is not installed.

What is your use case, when you need to add plugin into image?
Why you can’t install plugin into container (container!=image), by using env variable GF_INSTALL_PLUGINS -

I do not use the ENV variable because I’m behind a proxy with a huge filter on https, so I tried to build an image directly from dockerhub.

Hah, ordinary secure enterprise environment :-). Don’t install plugin into default /var/lib/grafana, but use different path - env variable GF_PLUGIN_DIR.

Example of Dockerfile, which installs plugins into /grafana-plugins directory:

Nice hint!
I will try it soon.

Hi Jan,

I’m trying to install a plugin on a docker container (i.e. grafana-worldmap-panel) but I’m having some trouble because I’m behind a corporate firewall and I cannot connect to . So the optimal way to do it (GF_PLUGINS_INSTALL) does not work.

I’ve tried with instructions found on grafana’s git repo but:

I know: corporate firewall + very strict security department. You may use your corporate http(s) proxy (if it is available) with env. variables http_proxy,https_proxy or some Docker image, where plugin will be preinstalled - for example, my full-fat XXL image -

My corporate firewall does not allow connections on 443 for unknown sites (as grafana is)

Ottieni Outlook per Android