WIUNIX ACADEMY
Prometheus and Grafana with Docker Compose: private monitoring and recovery
Build a private monitoring stack with pinned images, service discovery, provisioned dashboards, persistent data and a safe backup/restore rehearsal.
Make this guide yoursYOUR SYSTEM. YOUR STEPS.
Where are you working?
Choose your OS and version. The prerequisites, commands and troubleshooting follow your environment.
USE YOUR OWN VALUES
Configure this tutorial
Set the example values for your environment; related explanations and copy panels update together. Never enter passwords, private keys or tokens. Values stay in this tab and are not sent to the server or share links. Check actual DNS, certificates and network policy before running commands.
Different IP addresses, domains or ports? Open the settings below, change the values and select “Apply to tutorial”, then copy the updated commands.
Set values for my environment11 editable values
THE OUTCOME
What will you have at the end?
A private, digest-pinned Compose monitoring stack with verifiable collection and recoverable data.
Supported operating systems and versions
The DEB, RPM and rolling instructions were reviewed against documentation on 5 November 2026. Distribution/daemon/firewall/SSH installation was not executed across this matrix. Earlier isolated container checks used a different network adapter and do not establish complete Docker or distribution acceptance. Review advisories for the retained image pins before later use.
Before you begin
- Fresh dedicated host with sudo, console and authorized SSH; supported amd64/arm64 on DEB/RPM, x86_64 on these Arch/Manjaro paths.
- 2vCPU/4GiB RAM/20GiB local disk starting lab budget; actual ingest sizing required.
- Unused paths, ports and nonoverlapping bridge subnet; registry/package HTTPS egress.
- Protected password editor and approved encrypted off-host backup destination.
A Compose stack you can recover
Build a private Prometheus 3.15.0 and Grafana OSS 13.2.4 stack with pinned images, persistent storage, file-based scrape discovery, a provisioned dashboard and a controlled outage/recovery exercise. This intermediate guide takes about 60 minutes and assumes Linux, YAML and SSH experience. The result monitors these two services; it does not automatically measure the host or every Docker container. The separate host-monitoring guide covers that different task.
APT, RPM and rolling paths differ at installation and security setup: RPM keeps SELinux enforcing with Docker SELinux support and explicit labels for mounted data and the file-backed secret. Arch/Manjaro use native packages and a full synchronized upgrade of the fresh host. No web firewall port is opened; access stays on the existing SSH tunnel.
Follow the two network namespaces
The browser reaches host loopback ports 13000 and 19090 through existing SSH access to 192.0.2.40. Inside the dedicated bridge, Grafana queries http://prometheus:9090; Prometheus scrapes itself and grafana:3000. Container loopback is that container, not the host and not its neighbor. Service DNS survives replacement; fixed container IPs are unnecessary. Internal service ports 9090/3000 stay fixed; the public settings change only host/tunnel ports. No inbound web rule or public domain is needed.
Keep management off the internet
Only 127.0.0.1 is published. Require a maintained Docker Engine at least 28: older releases had a same-L2 localhost-publish exposure. Docker-published ports can bypass ordinary UFW policy; never change to an all-interface bind as a troubleshooting shortcut. Host root and Docker API users can read the files and reach the bridge. Do not add untrusted workloads to this network. A read-only Docker socket mount still exposes a privileged API; this guide mounts no socket, host root, cgroups or privileged exporter. cAdvisor and containerized node_exporter require their own host-access threat assessment.
Choose dedicated public values first
Choose an unused identifier academy-monitor, disjoint new absolute stack/backup directories, an unused bridge subnet 172.30.71.0/24, and distinct free host/tunnel ports. Paths must not be nested or existing; inspect symlinked parents and ownership separately. The subnet must not overlap LAN, VPN, routes or other Docker networks. SSH host/user/port describe your existing authorized access and do not create it. Retention is 15 days with a 5 GiB block limit; reserve extra disk for WAL, head data, Grafana, logs and backups. Applied settings and custom progress stay in sessionStorage in this tab/language/article/environment; default progress uses localStorage. Nothing enters share links or the server. Never enter secrets here. Custom values are not tested deployments.
LET’S BUILD
Inspect a fresh dedicated host
Use a new dedicated amd64 or arm64 host with sudo and independent console access. Start with 2 vCPU, 4 GiB RAM and at least 20 GiB free local disk for this small lab, then size from actual active series and ingest rate. Review routes and listeners. If a container runtime or workload exists, stop and plan its migration; do not remove packages or restart a shared daemon blindly.
Missing inspection tools mean this preflight is incomplete. Install only the host utilities in the next step, then repeat preflight before Docker. Missing route or memory output is not evidence that the host is ready.
Dedicated Linux host; Bash shell
cat /etc/os-release
uname -m
missing=0
for tool in df free ip ss; do
if ! command -v "$tool" >/dev/null; then
printf 'Required inspection utility missing: %s
' "$tool" >&2
missing=1
fi
done
if command -v df >/dev/null; then df -h /var/lib /srv; fi
if command -v free >/dev/null; then free -h; fi
if command -v ip >/dev/null; then ip -4 route show table all; fi
if command -v ss >/dev/null; then sudo ss -lntup; fi
pacman -Q docker docker-compose docker-buildx containerd runc podman podman-docker 2>/dev/null || true
systemctl is-active docker firewalld nftables || true
if test "$missing" -ne 0; then
printf 'Preflight incomplete. Install only host utilities in the next step, then repeat this check before installing Docker.
' >&2
false
fi
Supported OS/architecture, adequate resources, free selected ports and no existing runtime workload.
LET’S BUILD
Configure the official Docker repository
Install only host inspection/editor utilities from this distribution first; this is a full synchronized fresh-host upgrade, not a Docker install. If preflight reported missing tools, repeat it now and confirm resources/network before installing the runtime. Inspect native docker, docker-compose and docker-buildx candidates. Manjaro may lag Arch; never mix mirrors. Reboot after a kernel update when required and reconnect through existing SSH.
Dedicated Linux host; Bash shell
set -eu
sudo pacman -Syu --needed ca-certificates curl python nano iproute2 procps-ng
pacman -Si docker docker-compose docker-buildx
Correct signed vendor repository for the selected codename; no signature or missing-release error.