fix: run alloy in the host cgroup namespace (cgroup: host)

The cadvisor exporter reads /sys/fs/cgroup for per-container stats, but with the
default private cgroup namespace it only saw the container's own cgroup — so it
emitted machine-root container_* series (one per node, no name label) and no
per-container metrics. cgroup: host exposes the host cgroup tree so cadvisor
enumerates every container (mapped to names via the docker socket).
This commit is contained in:
deytenit committed 2026-07-12 02:52:43 +03:00
1 parent 9bc97f196f
commit 0a585cc061
1 file changed
+1
+1
View File
@@ -192,6 +192,7 @@ services:
image: grafana/alloy:v1.17.1 image: grafana/alloy:v1.17.1
container_name: apex-alloy container_name: apex-alloy
hostname: "${APEX_NODE_HOST}" # UTS hostname => node_exporter's node_uname_info `nodename` (else the container id) hostname: "${APEX_NODE_HOST}" # UTS hostname => node_exporter's node_uname_info `nodename` (else the container id)
cgroup: host # host cgroup namespace: the cadvisor exporter needs it to read per-container cgroups (else machine-root only)
profiles: [alloy] profiles: [alloy]
user: "0:0" # root: required for host metrics, journal, and docker.sock user: "0:0" # root: required for host metrics, journal, and docker.sock
volumes: volumes: