Grafana - dependency
We always recommend consulting the official Grafana website when deploying as this guide is not always updated in line with current Grafana release cycles. The official guide can be found here: https://grafana.com/docs/grafana/latest/installation/
Below is an extract from the Grafana website to set up Grafana using Docker, this is useful as a quick guide, however, as before we recommend you read the Grafana documentation above if you are unfamiliar with the system.
You can install and run Grafana using the official Docker image. It comes in two variants: Alpine and Ubuntu.
This page also contains important information about migrating from earlier Docker image versions.
Alpine image (recommended)
grafana/grafana:<version>
This is the default image. It’s based on the popular Alpine Linux project, available in the Alpine official image. Alpine Linux is much smaller than most distribution base images, and thus leads to slimmer and more secure images.
This variant is highly recommended when security and final image size being as small as possible is desired. The main caveat to note is that it uses musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements. However, most software don’t have an issue with this, so this variant is usually a very safe choice.
Note: The
grafana/grafana:<version>
image was based on Ubuntu before version 6.4.0.
Ubuntu image
grafana/grafana:<version>-ubuntu
This image is based on Ubuntu, available in the Ubuntu official image. It is an alternative image for those who prefer an Ubuntu based image and/or are dependent on certain tooling not available for Alpine.
Note: The
grafana/grafana:<version>-ubuntu
image is available for Grafana version 6.5.0 and later.
Run Grafana
You can run the latest Grafana version, run a specific version, or run an unstable version based on the master branch of the grafana/grafana GitHub repository.
Run the latest stable version of Grafana
Note: If you are on a Linux system, you might need to add
sudo
before the command.
Run a specific version of Grafana
Note: If you are on a Linux system, you might need to add
sudo
before the command.
Example:
Run the Grafana master branch
For every successful build of the master branch, we update the grafana/grafana:master
and grafana/grafana:master-ubuntu
tags. Additionally, two new tags are created, grafana/grafana-dev:<version>-<build ID>pre
and grafana/grafana-dev:<version>-<build ID>pre-ubuntu
, where version is the next version of Grafana and build ID is the ID of the corresponding CI build. Use these to get access to the latest master builds of Grafana.
When running Grafana master in production, we strongly recommend that you use the grafana/grafana-dev:<version>-<build ID>pre
tag. This tag guarantees that you use a specific version of Grafana instead of whatever was the most recent commit at the time.
For a list of available tags, check out grafana/grafana and grafana/grafana-dev.
Install plugins in the Docker container
You can install official and community plugins listed on the Grafana plugins page or from a custom URL.
Install official and community Grafana plugins
Pass the plugins you want installed to Docker with the GF_INSTALL_PLUGINS
environment variable as a comma-separated list. This sends each plugin name to grafana-cli plugins install ${plugin}
and installs them when Grafana starts.
If you need to specify the version of a plugin, then you can add it to the
GF_INSTALL_PLUGINS
environment variable. Otherwise, the latest will be assumed. For example:-e "GF_INSTALL_PLUGINS=grafana-clock-panel 1.0.1,grafana-simple-json-datasource 1.3.5"
.
Install plugins from other sources
Only available in Grafana v5.3.1 and later.
You can install plugins from custom URLs by specifying the URL like this: GF_INSTALL_PLUGINS=<url to plugin zip>;<plugin name>
.
Build and run a Docker image with pre-installed plugins
You can build your own customized image that includes plugins. This saves time if you are creating multiple images and you want them all to have the same plugins installed on build.
In the Grafana GitHub repository there is a folder called custom/
which includes two Dockerfiles, Dockerfile
and ubuntu.Dockerfile
, that can be used to build a custom Grafana image. It accepts GRAFANA_VERSION
, GF_INSTALL_PLUGINS
, and GF_INSTALL_IMAGE_RENDERER_PLUGIN
as build arguments.
Build with pre-installed plugins
If you need to specify the version of a plugin, you can add it to the
GF_INSTALL_PLUGINS
build argument. Otherwise, the latest will be assumed. For example:--build-arg "GF_INSTALL_PLUGINS=grafana-clock-panel 1.0.1,grafana-simple-json-datasource 1.3.5"
Example of how to build and run:
Replace Dockerfile
in above example with ubuntu.Dockerfile
to build a custom Ubuntu based image (Grafana v6.5+).
Build with Grafana Image Renderer plugin pre-installed
Only available in Grafana v6.5 and later. This is experimental.
The Grafana Image Renderer plugin does not currently work if it is installed in Grafana Docker image. You can build a custom Docker image by using the GF_INSTALL_IMAGE_RENDERER_PLUGIN
build argument. This installs additional dependencies needed for the Grafana Image Renderer plugin to run.
Example of how to build and run:
Replace Dockerfile
in above example with ubuntu.Dockerfile
to build a custom Ubuntu-based image (Grafana v6.5+).