Starting the stack
Start all services in detached mode
Run the following command from the root of the project (where Docker Compose pulls any missing images and starts five containers:
docker-compose.yml lives):prometheus, node-exporter, loki, promtail, and grafana.Verify all containers are running
Up. If any container shows Exited or is missing entirely, check its logs before proceeding (see Viewing service logs below).Open Grafana
Navigate to http://localhost:3000 in your browser.Log in with the default credentials:
- Username:
admin - Password:
admin
Service endpoints
Once the stack is running, each service is reachable on your host machine at the following addresses:| Service | Host URL | Container port |
|---|---|---|
| Grafana | http://localhost:3000 | 3000 |
| Prometheus UI | http://localhost:9090 | 9090 |
| Node Exporter metrics | http://localhost:9100/metrics | 9100 |
| Loki API | http://localhost:3100 | 3100 |
| Promtail | not exposed to host | 9080 |
Promtail does not expose a host port in
docker-compose.yml, so port 9080 is only reachable from other containers on the Docker network. When configuring datasources inside Grafana, use container-name URLs — for example, http://prometheus:9090 and http://loki:3100 — not localhost, since Grafana resolves these names over the internal Docker network.Viewing service logs
Follow the live log output for any individual service by passing its container name todocker compose logs:
Ctrl+C to stop following. Drop the -f flag to print existing logs without tailing.
Stopping the stack
To stop all running containers without removing their configuration:Restarting a single service
If you need to bounce one service — for example, after editingpromtail-config.yml — restart it without touching the rest of the stack:
prometheus, loki, node-exporter, or grafana.
Rebuilding after config changes
docker compose restart reuses the existing container. If you need Docker Compose to re-read a volume-mounted config file and apply it from scratch, force a full container recreation instead:
promtail container, removes it, and starts a fresh one with the updated config — without affecting the other four services.
Checking port availability
If a container fails to start, the host port it needs may already be in use. The ports each service binds on your host are:| Service | Host port |
|---|---|
| Prometheus | 9090 |
| Node Exporter | 9100 |
| Loki | 3100 |
| Grafana | 3000 |
Promtail does not expose a host port in
docker-compose.yml. Its HTTP server listens on port 9080 inside the container only.docker-compose.yml. For example, to move Prometheus to host port 19090:
docker compose up -d --force-recreate prometheus to apply the change.