{"id":51316969,"url":"https://github.com/tiennm99/alloy-docker-compose","last_synced_at":"2026-07-01T08:30:55.748Z","repository":{"id":353472409,"uuid":"1219569001","full_name":"tiennm99/alloy-docker-compose","owner":"tiennm99","description":"Single-container Grafana Alloy shipping host + Docker metrics/logs to Grafana Cloud Free. Env-driven, low-cardinality.","archived":false,"fork":false,"pushed_at":"2026-05-31T03:41:58.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-31T05:16:46.844Z","etag":null,"topics":["cadvisor","docker-compose","grafana-alloy","grafana-cloud","loki","monitoring","node-exporter","observability","prometheus","self-hosted"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tiennm99.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-24T02:20:57.000Z","updated_at":"2026-05-31T03:42:01.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tiennm99/alloy-docker-compose","commit_stats":null,"previous_names":["tiennm99/alloy-docker-compose"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tiennm99/alloy-docker-compose","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiennm99%2Falloy-docker-compose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiennm99%2Falloy-docker-compose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiennm99%2Falloy-docker-compose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiennm99%2Falloy-docker-compose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiennm99","download_url":"https://codeload.github.com/tiennm99/alloy-docker-compose/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiennm99%2Falloy-docker-compose/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34999790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-01T02:00:05.325Z","response_time":130,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cadvisor","docker-compose","grafana-alloy","grafana-cloud","loki","monitoring","node-exporter","observability","prometheus","self-hosted"],"created_at":"2026-07-01T08:30:53.489Z","updated_at":"2026-07-01T08:30:55.742Z","avatar_url":"https://github.com/tiennm99.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# alloy-docker-compose\n\nOne-file [Grafana Alloy](https://grafana.com/docs/alloy/latest/) setup that ships host (linux) and container (docker) telemetry to Grafana Cloud, plus pulls remote config from Grafana Fleet Management.\n\n- **Single container** running both `node_exporter` (host) and `cadvisor` (containers) collectors.\n- **Config embedded inline** via Compose `configs:` — no sidecar `config.alloy` file on disk.\n- **Env-driven** — nine shell variables, no `.env` file.\n- **Remote config** via `remotecfg` block (Grafana Fleet Management).\n\n## What it collects\n\n| Source | Component | Notes |\n|---|---|---|\n| Host metrics | `prometheus.exporter.unix` | CPU, memory, load, disk I/O, filesystem, network, uname, boot time, systemd, vmstat, sockstat — full default-collector set minus `ipvs/btrfs/infiniband/xfs/zfs` |\n| Container metrics | `prometheus.exporter.cadvisor` | CPU, memory, fs usage/limit, network, `last_seen` |\n| Container logs | `loki.source.docker` | all running containers, labeled with `container`, `stream`, `instance` |\n| System logs (journal) | `loki.source.journal` (via `journal_module`) | systemd journal with `unit`, `boot_id`, `transport`, `level` labels |\n| System logs (files) | `loki.source.file` | `/var/log/syslog`, `/var/log/messages`, `/var/log/*.log` |\n| Remote config | `remotecfg` | polls Grafana Fleet Management every 60s |\n\nFiltering follows the upstream Grafana Cloud integration configs verbatim — `keep`-lists copied from each integration's **Metrics** section ([Linux Node](https://grafana.com/docs/grafana-cloud/monitor-infrastructure/integrations/integration-reference/integration-linux-node/#metrics), [Docker](https://grafana.com/docs/grafana-cloud/monitor-infrastructure/integrations/integration-reference/integration-docker/#metrics)). Logs are unfiltered.\n\n\u003e **Log duplication caveat.** On systems where rsyslog mirrors journald to `/var/log/syslog` (e.g. Debian/Ubuntu defaults), enabling both pipelines double-ships the same lines. If that's the case for your hosts, drop one source — typically the file-based one is redundant on systemd-only stacks.\n\n## Quick start\n\n```bash\nexport ALLOY_HOSTNAME=miti-jp                                                                      # also used as Loki/Prometheus instance label\nexport REMOTECFG_URL=https://fleet-management-prod-013.grafana.net\nexport REMOTECFG_ID=miti-jp                                                                        # fleet-management agent id\nexport REMOTECFG_USER=1431677                                                                      # fleet-management user id\nexport PROM_URL=https://prometheus-prod-XX-\u003cregion\u003e.grafana.net/api/prom/push\nexport PROM_USER=\u003cprometheus-user-id\u003e\nexport LOKI_URL=https://logs-prod-XXX.grafana.net/loki/api/v1/push\nexport LOKI_USER=\u003cloki-user-id\u003e\nexport GRAFANA_TOKEN=glc_...                                                                       # one Cloud Access Policy token, scopes: metrics:write + logs:write + fleet-management:read\n\ndocker compose up -d\n```\n\nFind the `PROM_*` / `LOKI_*` / `REMOTECFG_*` values under Grafana Cloud → your stack → **Details** on each data source / Fleet Management. The same token is reused for `remotecfg`, Prometheus, and Loki basic-auth.\n\nAny unset required variable makes `docker compose up` fail fast.\n\n## Multi-host\n\nSame compose file on every host — change `ALLOY_HOSTNAME` and `REMOTECFG_ID` per host. Filter in Grafana with `instance=~\"...\"`.\n\n## Security note\n\nRuns `privileged: true` + `network_mode: host`, matching the upstream Grafana Cloud docker integration. `network_mode: host` is required so `prometheus.exporter.unix` reports the host's real network interfaces (eth0…) instead of the alloy container's veth pair. If you need least-privilege, see the upstream Alloy docker integration docs and tighten capabilities.\n\n## Mounts\n\n| Mount | Why |\n|---|---|\n| `/proc:/rootproc:ro` | node-exporter cpu/mem/load (referenced via `procfs_path`) |\n| `/sys:/sys:ro` | node-exporter + cadvisor cgroups |\n| `/:/rootfs:ro` | filesystem collector (referenced via `rootfs_path`) |\n| `/dev/disk/:/dev/disk:ro` | node-exporter diskstats device labels |\n| `/var/run/docker.sock` | `discovery.docker` + `loki.source.docker` |\n| `/var/lib/docker:ro` | cadvisor container metadata |\n| `/var/log:/var/log:ro` | `loki.source.journal` (`/var/log/journal`) + `loki.source.file` (syslog/messages/*.log) |\n| `/etc/machine-id:ro` | stable host id for the journal reader |\n| `alloy-data` (named volume) | WAL + remotecfg cache |\n\n## Design\n\n- [Upstream sources of truth](docs/upstream-sources-of-truth.md) — what we follow, what's in scope, how to audit dashboard metric needs.\n\n## Known noise (special cases)\n\n- [Coolify SSH session spam](docs/known-noise-coolify-ssh-sessions.md) — only relevant if Coolify manages the host. Safe to ignore otherwise.\n\n## License\n\nApache 2.0 — see [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiennm99%2Falloy-docker-compose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiennm99%2Falloy-docker-compose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiennm99%2Falloy-docker-compose/lists"}