grafana / grafana-docker

Grafana docker container
Other
645 stars 378 forks source link

Supporting easy bundling of plugins into the Grafana image #147

Closed xlson closed 6 years ago

xlson commented 6 years ago

Background

The Grafana docker image supports installing plugins on the fly when it boots which is enough for most users. But if you are running an instance behind a firewall or without internet access that won't work. In this case its neccessary to build a new docker image that bundles the plugins.

Solutions

1. Extending the main Dockerfile

This would make it possible to specify plugins using docker build --build-arg "GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource" . at build time.

# Add this in the main Dockerfile for Grafana
ARG GF_INSTALL_PLUGINS=""

RUN if [ ! -z "${GF_INSTALL_PLUGINS}" ]; then \
    OLDIFS=$IFS; \
        IFS=','; \
    for plugin in ${GF_INSTALL_PLUGINS}; do \
        IFS=$OLDIFS; \
        grafana-cli --pluginsDir "$GF_PATHS_PLUGINS" plugins install ${plugin}; \
    done; \
fi

Pros:

Cons:

2. Creating an example Dockerfile

We could modify option 1 to fit into an example and stick it in examples/.

Pros:

Cons:

3. Putting a solution in the docs

Pros:

Cons:

xlson commented 6 years ago

@DanCech Talked a bit with @bergquist yesterday and now I'm leaning towards option 2 again so I created this issue for us (and anyone else who has opinions) to discuss it.

DanCech commented 6 years ago

I think 2 makes the most sense, as far as it being hard to find we'd still have the docs section and it would be able to link to the file for the user to download vs having to copy-paste from the docs themselves.

That Dockerfile can also have ARG GF_VERSION=latest so the user can build whatever grafana version they like via build args.

https://docs.docker.com/engine/reference/builder/#from