You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/cadvisor.md
+66Lines changed: 66 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@ Now we'll need to create a Docker Compose [configuration](https://docs.docker.co
26
26
27
27
In the same folder where you created the [`prometheus.yml`](#prometheus-configuration) file, create a `docker-compose.yml` file and populate it with this Docker Compose configuration:
28
28
29
+
### Using Bind Mounts
29
30
```yaml
30
31
version: '3.2'
31
32
services:
@@ -92,6 +93,71 @@ cadvisor /usr/bin/cadvisor -logtostderr Up 8080/tcp
92
93
prometheus /bin/prometheus --config.f ... Up 0.0.0.0:9090->9090/tcp
93
94
redis docker-entrypoint.sh redis ... Up 0.0.0.0:6379->6379/tcp
94
95
```
96
+
### Alternative: Using Inline Docker Configs (Remote Deployments)
97
+
98
+
If you're managing a remote Docker host and prefer to keep all configuration within the docker-compose.yml file (avoiding the need to manage separate config files on the host), you can use Docker's configs feature:
99
+
100
+
```yaml
101
+
version: '3.8'
102
+
103
+
configs:
104
+
prometheus_config:
105
+
content: |
106
+
scrape_configs:
107
+
- job_name: 'cadvisor'
108
+
scrape_interval: 5s
109
+
static_configs:
110
+
- targets: ['cadvisor:8080']
111
+
112
+
services:
113
+
prometheus:
114
+
image: prom/prometheus:latest
115
+
container_name: prometheus
116
+
ports:
117
+
- 9090:9090
118
+
command:
119
+
- --config.file=/etc/prometheus/prometheus.yml
120
+
configs:
121
+
- source: prometheus_config
122
+
target: /etc/prometheus/prometheus.yml
123
+
uid: "65534" # Required: numeric UID for 'nobody' user
124
+
gid: "65534" # Required: numeric GID for 'nobody' group
125
+
mode: 0400 # Required: read-only permissions
126
+
depends_on:
127
+
- cadvisor
128
+
129
+
cadvisor:
130
+
image: gcr.io/cadvisor/cadvisor:latest
131
+
container_name: cadvisor
132
+
ports:
133
+
- 8080:8080
134
+
volumes:
135
+
- /:/rootfs:ro
136
+
- /var/run:/var/run:rw
137
+
- /sys:/sys:ro
138
+
- /var/lib/docker/:/var/lib/docker:ro
139
+
depends_on:
140
+
- redis
141
+
142
+
redis:
143
+
image: redis:latest
144
+
container_name: redis
145
+
ports:
146
+
- 6379:6379
147
+
```
148
+
149
+
#### Important Notes
150
+
151
+
⚠️ **Required Fields**: When using Docker `configs`, you **must** explicitly specify `uid`, `gid`, and `mode` as numeric values:
152
+
153
+
- `uid: "65534"` - The numeric user ID (65534 = `nobody` user in the Prometheus image)
154
+
- `gid: "65534"` - The numeric group ID (65534 = `nobody` group)
155
+
- `mode: 0400` - File permissions (read-only for owner)
156
+
157
+
Omitting these fields or using string values like `"nobody"` will cause the following error:
0 commit comments