Skip to content

Commit c5ffad5

Browse files
committed
docs: Update docker installation topic
1 parent ae180d6 commit c5ffad5

File tree

1 file changed

+88
-23
lines changed

1 file changed

+88
-23
lines changed

docs/sources/setup/install/docker.md

+88-23
Original file line numberDiff line numberDiff line change
@@ -9,55 +9,120 @@ weight: 400
99
# Install Loki with Docker or Docker Compose
1010

1111
You can install Loki and Promtail with Docker or Docker Compose if you are evaluating, testing, or developing Loki.
12-
For production, Grafana recommends installing with Tanka or Helm.
12+
For production, Grafana recommends installing with Helm or Tanka.
1313

14-
The configuration acquired with these installation instructions run Loki as a single binary.
14+
The configuration files associated with these installation instructions run Loki as a single binary.
1515

1616
## Prerequisites
1717

1818
- [Docker](https://docs.docker.com/install)
1919
- [Docker Compose](https://docs.docker.com/compose/install) (optional, only needed for the Docker Compose install method)
2020

21-
## Install with Docker
21+
## Install with Docker on Linux
2222

23-
**Linux**
23+
1. Create a directory called `loki`. Make `loki` your current working directory:
2424

25-
Copy and paste the commands below into your command line.
25+
```bash
26+
mkdir loki
27+
cd loki
28+
```
2629

27-
```bash
28-
wget https://raw.githubusercontent.com/grafana/loki/v2.9.2/cmd/loki/loki-local-config.yaml -O loki-config.yaml
29-
docker run --name loki -d -v $(pwd):/mnt/config -p 3100:3100 grafana/loki:2.9.2 -config.file=/mnt/config/loki-config.yaml
30-
wget https://raw.githubusercontent.com/grafana/loki/v2.9.2/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml
31-
docker run --name promtail -d -v $(pwd):/mnt/config -v /var/log:/var/log --link loki grafana/promtail:2.9.2 -config.file=/mnt/config/promtail-config.yaml
32-
```
30+
1. Copy and paste the following commands into your command line to download `loki-local-config.yaml` and `promtail-docker-config.yaml` to your `loki` directory.
31+
32+
```bash
33+
wget https://raw.githubusercontent.com/grafana/loki/v2.9.2/cmd/loki/loki-local-config.yaml -O loki-config.yaml
34+
wget https://raw.githubusercontent.com/grafana/loki/v2.9.2/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml
35+
```
36+
37+
1. Copy and paste the following commands into your command line to start the Docker containers using the configuration files you downloaded in the previous step.
38+
39+
```bash
40+
docker run --name loki -d -v $(pwd):/mnt/config -p 3100:3100 grafana/loki:2.9.2 -config.file=/mnt/config/loki-config.yaml
41+
docker run --name promtail -d -v $(pwd):/mnt/config -v /var/log:/var/log --link loki grafana/promtail:2.9.2 -config.file=/mnt/config/promtail-config.yaml
42+
```
43+
44+
{{< admonition type="note" >}}
45+
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 a numeric UID suited to your needs.
46+
{{< /admonition >}}
3347

34-
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.
48+
1. Verify that your containers are running:
3549

36-
Navigate to http://localhost:3100/metrics to view the metrics and http://localhost:3100/ready for readiness.
50+
```bash
51+
docker container ls
52+
```
3753

38-
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.
54+
You should see something similar to the following:
3955

40-
**Windows**
56+
```bash
4157
42-
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.
58+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
59+
9485de9ad351 grafana/promtail:2.9.2 "/usr/bin/promtail -…" About a minute ago Up About a minute promtail
60+
cece1df84519 grafana/loki:2.9.2 "/usr/bin/loki -conf…" About a minute ago Up About a minute 0.0.0.0:3100->3100/tcp, :::3100->3100/tcp loki
61+
```
62+
63+
1. Verify that Loki is up and running.
64+
65+
- To view readiness, navigate to http://localhost:3100/ready.
66+
- To view metrics, navigate to http://localhost:3100/metrics.
67+
68+
## Install with Docker on Windows
69+
70+
1. Copy and paste the following commands into your command line to download `loki-local-config.yaml` and `promtail-docker-config.yaml` to your `loki` directory. Note that you will need to replace the `<local-path>` in the commands with your local path.
4371

4472
```bash
4573
cd "<local-path>"
4674
wget https://raw.githubusercontent.com/grafana/loki/v2.9.2/cmd/loki/loki-local-config.yaml -O loki-config.yaml
47-
docker run --name loki -v <local-path>:/mnt/config -p 3100:3100 grafana/loki:2.9.2 --config.file=/mnt/config/loki-config.yaml
4875
wget https://raw.githubusercontent.com/grafana/loki/v2.9.2/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml
76+
```
77+
78+
1. Copy and paste the following commands into your command line to start the Docker containers using the configuration files you downloaded in the previous step. Note that you will need to replace the `<local-path>` in the commands with your local path.
79+
80+
```bash
81+
docker run --name loki -v <local-path>:/mnt/config -p 3100:3100 grafana/loki:2.9.2 --config.file=/mnt/config/loki-config.yaml
4982
docker run -v <local-path>:/mnt/config -v /var/log:/var/log --link loki grafana/promtail:2.9.2 --config.file=/mnt/config/promtail-config.yaml
5083
```
5184

52-
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.
85+
1. Verify that Loki is up and running.
5386

54-
Navigate to http://localhost:3100/metrics to view the output.
87+
- To view readiness, navigate to http://localhost:3100/ready.
88+
- To view metrics, navigate to http://localhost:3100/metrics.
5589

5690
## Install with Docker Compose
5791

5892
Run the following commands in your command line. They work for Windows or Linux systems.
5993

60-
```bash
61-
wget https://raw.githubusercontent.com/grafana/loki/v2.9.2/production/docker-compose.yaml -O docker-compose.yaml
62-
docker-compose -f docker-compose.yaml up
63-
```
94+
1. Create a directory called `loki`. Make `loki` your current working directory:
95+
96+
```bash
97+
mkdir loki
98+
cd loki
99+
```
100+
101+
1. Copy and paste the following command into your command line to download the `docker-compose` file.
102+
103+
```bash
104+
wget https://raw.githubusercontent.com/grafana/loki/v2.9.2/production/docker-compose.yaml -O docker-compose.yaml
105+
```
106+
107+
1. With `loki` as the current working directory, run the following 'docker-compose` command:
108+
109+
```bash
110+
docker-compose -f docker-compose.yaml up
111+
```
112+
113+
You should see something similar to the following:
114+
115+
```bash
116+
✔ Container mydevice-minio-1 Started 0.0s
117+
✔ Container mydevice-flog-1 Started 0.0s
118+
✔ Container mydevice-write-1 Started 0.0s
119+
✔ Container mydevice-read-1 Started 0.0s
120+
✔ Container mydevice-gateway-1 Started 0.0s
121+
✔ Container mydevice-grafana-1 Started 0.0s
122+
✔ Container mydevice-promtail-1 Started 0.0s
123+
```
124+
125+
1. Verify that Loki is up and running.
126+
127+
- To view readiness, navigate to http://localhost:3100/ready.
128+
- To view metrics, navigate to http://localhost:3100/metrics.

0 commit comments

Comments
 (0)