Skip to main content

Docker Installation

This guide covers installing and running Grafana using Docker containers. You can run Grafana using the Docker CLI or Docker Compose.

Docker Images

Grafana provides official Docker images hosted on Docker Hub:
  • Grafana Enterprise: grafana/grafana-enterprise
  • Grafana Open Source: grafana/grafana
Starting with Grafana 12.4.0, the grafana/grafana-oss repository will no longer be updated. Use grafana/grafana instead, which contains the same Grafana OSS images.
The default images are built on Alpine Linux 3.23.3. All images run on port 3000 by default and use UID 472 for the grafana user.

Run Grafana with Docker CLI

The simplest way to run Grafana is using the Docker CLI.

Persistent Storage

By default, Grafana data is stored inside the container and will be lost when the container is removed. Use Docker volumes or bind mounts to persist data. Docker volumes are managed by Docker and are the recommended approach for persistent storage.

Using Bind Mounts

Bind mounts map a host directory to the container. You must run the container with a user that has permission to access the directory.

Environment Variables

Configure Grafana using environment variables. All Grafana configuration options can be set using the GF_<SectionName>_<KeyName> format.

Common Configuration

Environment Variables for Docker Secrets

You can use Docker secrets by appending __FILE to environment variables:

Install Plugins

Install plugins at container startup using the GF_PLUGINS_PREINSTALL environment variable.

Install from plugin catalog

Install specific version

Install from custom URL

Run Grafana with Docker Compose

Docker Compose simplifies multi-container deployments using YAML configuration files.

Basic Configuration

Create a docker-compose.yaml file:
Start Grafana:
Stop Grafana:

With Persistent Storage

With Environment Variables

With Bind Mounts

Container Configuration Paths

The Grafana Docker image uses the following paths:

Entry Point Script

The Docker image uses /run.sh as the entry point, which:
  1. Validates file permissions for configuration and data directories
  2. Processes environment variables ending in __FILE for Docker secrets
  3. Configures AWS credentials if GF_AWS_PROFILES is set
  4. Starts the Grafana server with appropriate configuration flags

Next Steps

  • Configure Grafana data sources
  • Set up authentication
  • Install additional plugins
  • Configure provisioning for dashboards and data sources