2016-10-21 17:01:34 +08:00
+++
title = "Installing using Docker"
description = "Installing Grafana using Docker guide"
keywords = ["grafana", "configuration", "documentation", "docker"]
type = "docs"
[menu.docs]
name = "Installing using Docker"
identifier = "docker"
parent = "installation"
weight = 4
+++
2015-04-13 13:34:55 +08:00
# Installing using Docker
2018-04-14 02:02:45 +08:00
Grafana is very easy to install and run using the official docker container.
2015-04-13 13:55:07 +08:00
2017-10-06 01:01:03 +08:00
```bash
$ docker run -d -p 3000:3000 grafana/grafana
```
2015-04-13 13:55:07 +08:00
2015-05-11 04:52:40 +08:00
All Grafana configuration settings can be defined using environment
variables, this is especially useful when using the above container.
2015-04-13 13:55:07 +08:00
## Docker volumes & ENV config
2015-05-11 04:52:40 +08:00
The Docker container exposes two volumes, the sqlite3 database in the
folder `/var/lib/grafana` and configuration files is in `/etc/grafana/`
folder. You can map these volumes to host folders when you start the
container:
2015-04-13 13:55:07 +08:00
2017-10-06 01:01:03 +08:00
```bash
$ docker run -d -p 3000:3000 \
-v /var/lib/grafana:/var/lib/grafana \
-e "GF_SECURITY_ADMIN_PASSWORD=secret" \
grafana/grafana
```
2015-04-13 13:55:07 +08:00
2015-05-11 04:52:40 +08:00
In the above example I map the data folder and sets a configuration option via
2017-10-25 20:21:32 +08:00
an `ENV` instruction.
See the [docker volumes documentation ](https://docs.docker.com/engine/admin/volumes/volumes/ ) if you want to create a volume to use with the Grafana docker image instead of a bind mount (binding to a directory in the host system).
2015-04-13 13:55:07 +08:00
## Configuration
2017-10-25 20:21:32 +08:00
All options defined in conf/grafana.ini can be overridden using environment
variables by using the syntax `GF_<SectionName>_<KeyName>` .
For example:
```bash
$ docker run \
-d \
-p 3000:3000 \
--name=grafana \
-e "GF_SERVER_ROOT_URL=http://grafana.server.name" \
-e "GF_SECURITY_ADMIN_PASSWORD=secret" \
grafana/grafana
```
You can use your own grafana.ini file by using environment variable `GF_PATHS_CONFIG` .
The back-end web server has a number of configuration options. Go to the
2016-10-21 17:01:34 +08:00
[Configuration ]({{< relref "configuration.md" >}} ) page for details on all
2015-05-11 04:52:40 +08:00
those options.
2015-04-13 13:34:55 +08:00
2017-10-25 20:21:32 +08:00
## Installing Plugins for Grafana
Pass the plugins you want installed to docker with the `GF_INSTALL_PLUGINS` environment variable as a comma separated list. This will pass each plugin name to `grafana-cli plugins install ${plugin}` .
```bash
docker run \
-d \
-p 3000:3000 \
--name=grafana \
-e "GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource" \
grafana/grafana
```
## Running a Specific Version of Grafana
```bash
# specify right tag, e.g. 4.5.2 - see Docker Hub for available tags
$ docker run \
-d \
-p 3000:3000 \
--name grafana \
2018-03-15 00:09:02 +08:00
grafana/grafana:5.0.2
2017-10-25 20:21:32 +08:00
```
## Configuring AWS Credentials for CloudWatch Support
```bash
$ docker run \
-d \
-p 3000:3000 \
--name=grafana \
-e "GF_AWS_PROFILES=default" \
-e "GF_AWS_default_ACCESS_KEY_ID=YOUR_ACCESS_KEY" \
-e "GF_AWS_default_SECRET_ACCESS_KEY=YOUR_SECRET_KEY" \
-e "GF_AWS_default_REGION=us-east-1" \
grafana/grafana
```
You may also specify multiple profiles to `GF_AWS_PROFILES` (e.g.
`GF_AWS_PROFILES=default another` ).
Supported variables:
- `GF_AWS_${profile}_ACCESS_KEY_ID` : AWS access key ID (required).
- `GF_AWS_${profile}_SECRET_ACCESS_KEY` : AWS secret access key (required).
- `GF_AWS_${profile}_REGION` : AWS region (optional).