Skip to main content

Starting the stack

1

Start all services in detached mode

Run the following command from the root of the project (where docker-compose.yml lives):
docker compose up -d
Docker Compose pulls any missing images and starts five containers: prometheus, node-exporter, loki, promtail, and grafana.
2

Verify all containers are running

docker compose ps
You should see all five containers with a status of Up. If any container shows Exited or is missing entirely, check its logs before proceeding (see Viewing service logs below).
3

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:
ServiceHost URLContainer port
Grafanahttp://localhost:30003000
Prometheus UIhttp://localhost:90909090
Node Exporter metricshttp://localhost:9100/metrics9100
Loki APIhttp://localhost:31003100
Promtailnot exposed to host9080
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 to docker compose logs:
# Follow Prometheus logs
docker compose logs -f prometheus

# Follow Loki logs
docker compose logs -f loki

# Follow Promtail logs
docker compose logs -f promtail

# Follow Node Exporter logs
docker compose logs -f node-exporter

# Follow Grafana logs
docker compose logs -f grafana
Press 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:
docker compose down
This stops and removes the containers but leaves your config files and any local volumes intact.

Restarting a single service

If you need to bounce one service — for example, after editing promtail-config.yml — restart it without touching the rest of the stack:
docker compose restart promtail
You can substitute any service name: 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:
docker compose up -d --force-recreate promtail
This stops the 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:
ServiceHost port
Prometheus9090
Node Exporter9100
Loki3100
Grafana3000
Promtail does not expose a host port in docker-compose.yml. Its HTTP server listens on port 9080 inside the container only.
To check whether a port is already occupied:
sudo ss -tlnp | grep 9090
If the port is in use by another process, either stop that process or change the host-side port mapping in docker-compose.yml. For example, to move Prometheus to host port 19090:
prometheus:
  ports:
    - "19090:9090"
Then run docker compose up -d --force-recreate prometheus to apply the change.