github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/docs/sources/installation/docker.md (about) 1 --- 2 title: Docker 3 weight: 30 4 --- 5 # Install Grafana Loki with Docker or Docker Compose 6 7 You can install Grafana Loki and Promtail with Docker or Docker Compose if you are evaluating, testing, or developing Loki. 8 For production, we recommend installing with Tanka or Helm. 9 10 The configuration acquired with these installation instructions run Loki as a single binary. 11 12 ## Prerequisites 13 14 - [Docker](https://docs.docker.com/install) 15 - [Docker Compose](https://docs.docker.com/compose/install) (optional, only needed for the Docker Compose install method) 16 17 ## Install with Docker 18 19 **Linux** 20 21 Copy and paste the commands below into your command line. 22 23 ```bash 24 wget https://raw.githubusercontent.com/grafana/loki/v2.6.1/cmd/loki/loki-local-config.yaml -O loki-config.yaml 25 docker run --name loki -d -v $(pwd):/mnt/config -p 3100:3100 grafana/loki:2.6.1 -config.file=/mnt/config/loki-config.yaml 26 wget https://raw.githubusercontent.com/grafana/loki/v2.6.1/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml 27 docker run --name promtail -d -v $(pwd):/mnt/config -v /var/log:/var/log --link loki grafana/promtail:2.6.1 -config.file=/mnt/config/promtail-config.yaml 28 ``` 29 30 When finished, `loki-config.yaml` and `promtail-config.yaml` are downloaded in the directory you chose. Docker containers are running Loki and Promtail using those config files. 31 32 Navigate to http://localhost:3100/metrics to view the metrics and http://localhost:3100/ready for readiness. 33 34 The image is configured to run by default as user loki with UID `10001` and GID `10001`. You can use a different user, specially if you are using bind mounts, by specifying the UID with a `docker run` command and using `--user=UID` with numeric UID suited to your needs. 35 36 **Windows** 37 38 Copy and paste the commands below into your terminal. Note that you will need to replace the `<placeholders>` in the commands with your local path. 39 40 ```bash 41 cd "<local-path>" 42 wget https://raw.githubusercontent.com/grafana/loki/v2.6.1/cmd/loki/loki-local-config.yaml -O loki-config.yaml 43 docker run --name loki -v <local-path>:/mnt/config -p 3100:3100 grafana/loki:2.6.1 --config.file=/mnt/config/loki-config.yaml 44 wget https://raw.githubusercontent.com/grafana/loki/v2.6.1/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml 45 docker run -v <local-path>:/mnt/config -v /var/log:/var/log --link loki grafana/promtail:2.6.1 --config.file=/mnt/config/promtail-config.yaml 46 ``` 47 48 When finished, `loki-config.yaml` and `promtail-config.yaml` are downloaded in the directory you chose. Docker containers are running Loki and Promtail using those config files. 49 50 Navigate to http://localhost:3100/metrics to view the output. 51 52 ## Install with Docker Compose 53 54 Run the following commands in your command line. They work for Windows or Linux systems. 55 56 ```bash 57 wget https://raw.githubusercontent.com/grafana/loki/v2.6.1/production/docker-compose.yaml -O docker-compose.yaml 58 docker-compose -f docker-compose.yaml up 59 ```