Skip to content

Commit da6ddd9

Browse files
committed
docs: add rootless example
1 parent 255cff7 commit da6ddd9

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docs/running.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,31 @@ If you are using Docker with the LXC exec driver, then you need to manually spec
103103

104104
This is a problem seen in older versions of Docker. To fix, start cAdvisor without the `--volume=/:/rootfs:ro` mount. cAdvisor will degrade gracefully by dropping stats that depend on access to the machine root.
105105

106+
### Rootless (Docker / Podman)
107+
108+
Running cAdivsor on rootless container runtimes works for the most part. However granting access to the host kernel message buffer (`--device /dev/kmsg`) for OOM (out of memory) detection does not work.
109+
110+
Based on the container runtime used the socket needs to be changed appriopriately. Additionally the container storage volume, must be changed to the corresponding container runtime user directory. When using Podman you must also include `--volume=/sys/fs/cgroup:/sys/fs/cgroup:ro`.
111+
112+
```sh
113+
VERSION=v0.49.1 # use the latest release version from https://github.com/google/cadvisor/releases
114+
docker run \
115+
--volume=/:/rootfs:ro \
116+
--volume=/var/run:/var/run:ro \
117+
--volume=/sys:/sys:ro \
118+
# --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro \ # Required for Podman subcontainers
119+
--volume=$HOME/.local/share/docker/:/var/lib/docker:ro \ # Docker Rootless
120+
# --volume=$HOME/.local/share/containers:/var/lib/containers:ro # Podman Rootless
121+
--volume=/dev/disk/:/dev/disk:ro \
122+
--docker=unix:///var/run/user/$(id -u)/docker.sock \
123+
# --podman=unix:///var/run/user/$(id -u)/podman/podman.sock \ # Podman Rootless
124+
--publish=8080:8080 \
125+
--detach=true \
126+
--name=cadvisor \
127+
--privileged \
128+
gcr.io/cadvisor/cadvisor:$VERSION
129+
```
130+
106131
## Standalone
107132

108133
cAdvisor is a static Go binary with no external dependencies. To run it standalone all you should need to do is run it! Note that some data sources may require root privileges. cAdvisor will gracefully degrade its features to those it can expose with the access given.

0 commit comments

Comments
 (0)