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.grafana user.
Run Grafana with Docker CLI
The simplest way to run Grafana is using the Docker CLI.-d)-p 3000:3000)grafana (--name=grafana)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.Using Docker Volumes (Recommended)
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 theGF_<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 theGF_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 adocker-compose.yaml file:
With Persistent Storage
With Environment Variables
With Bind Mounts
Container Configuration Paths
The Grafana Docker image uses the following paths:| Path | Description |
|---|---|
/etc/grafana/grafana.ini | Configuration file |
/var/lib/grafana | Data directory (dashboards, users, etc.) |
/var/log/grafana | Log directory |
/usr/share/grafana | Installation directory |
/var/lib/grafana/plugins | Plugins directory |
/etc/grafana/provisioning | Provisioning directory |
Entry Point Script
The Docker image uses/run.sh as the entry point, which:
- Validates file permissions for configuration and data directories
- Processes environment variables ending in
__FILEfor Docker secrets - Configures AWS credentials if
GF_AWS_PROFILESis set - 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