Why use the Docker environment
We have chosen to use Docker because it simplifies the process of creating, deploying, and running applications. It allows you to create consistent and isolated environments for your plugin. This makes it easy to manage dependencies and ensure that the plugin runs the same way across different machines.
create-plugin tool, the Docker container is configured with the necessary variables to allow easy access to Grafana and to load plugins without the need for them to be signed. The plugin tool also adds a live reload feature that allows you to make your frontend code changes to trigger refreshes in the browser.
Get started with Docker
To start your plugin development project, run the following commands in the order listed:
npm install: Installs frontend dependencies.
npm run dev: Builds and watches the plugin frontend code.
mage -v build:linux: Builds the plugin backend code. Rerun this command every time that you edit your backend files.
npm run server: Starts a Grafana development server running on http://localhost:3000. Restart this command each time you run
mageto run your new backend code.
Configure the Grafana version
To test a plugin across different versions of Grafana, set an environment variable. Use
GRAFANA_VERSION to set the Grafana version:
GRAFANA_VERSION=10.0.0 npm run server
GRAFANA_VERSION=10.0.0 pnpm run server
GRAFANA_VERSION=10.0.0 yarn run server
Configure the Grafana image
The default Docker image in the plugin tool is
grafana-enterprise. If you want to override this image, alter the
docker-compose.yaml by changing the
grafana_image build argument like so:
This example assigns the environment variable
GRAFANA_IMAGE to the build arg
grafana_image with a default value of
grafana. This gives you the option to set the value when running