Docker Integration
Kloudfuse can collect telemetry from Docker environments using the Datadog Agent.
Quick Start
To start collecting all signal types from your Docker host in a single docker run command:
docker run -d \
--name datadog-agent \
-e DD_API_KEY=kloudfuse \
-e DD_DD_URL=https://<kloudfuse-hostname> \
-e DD_SKIP_SSL_VALIDATION=true \
-e DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true \
-e DD_LOGS_ENABLED=true \
-e DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true \
-e DD_LOGS_CONFIG_LOGS_DD_URL=<kloudfuse-hostname>:443 \
-e DD_LOGS_CONFIG_USE_HTTP=true \
-e DD_APM_ENABLED=true \
-e DD_APM_DD_URL=<kloudfuse-hostname>:443 \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
--volume /proc:/host/proc:ro \
--volume /sys:/host/sys:ro \
--volume /host:/host:ro \
datadog/agent:latest
|
Each signal has its own endpoint. Add |
Docker Compose Deployment
For Docker Compose environments, add a datadog service to your existing docker-compose.yaml and build a custom agent image to point the agent at Kloudfuse.
Add the Agent Service
Add the following datadog service entry to your docker-compose.yaml:
services:
datadog:
build: ./datadog
container_name: datadog-agent
links:
- <your-service> # add links to services you want to monitor
environment:
- DD_API_KEY=kloudfuse
- DD_CONTAINER_EXCLUDE=name:datadog-agent # optional: exclude agent's own logs
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /proc/:/host/proc/:ro
- /sys/fs/cgroup:/host/sys/fs/cgroup:ro
- /var/lib/docker/containers:/var/lib/docker/containers:ro
Create the Agent Configuration
Create a datadog/ directory and add a datadog.yaml file to configure the agent to send all signal types to Kloudfuse:
api_key: kloudfuse
site: datadoghq.com
dd_url: https://<kloudfuse-hostname>
skip_ssl_validation: true # remove if you want to enforce TLS validation
logs_enabled: true
logs_config:
logs_dd_url: https://<kloudfuse-hostname>
use_http: true
logs_no_ssl: false
auto_multi_line_detection: false
use_v2_api: false
container_collect_all: true
apm_config:
enabled: true
apm_dd_url: "https://<kloudfuse-hostname>/ingester"
process_config:
process_dd_url: "https://<kloudfuse-hostname>/ingester"
events_dd_url: "https://<kloudfuse-hostname>/ingester"
container_collection:
enabled: false
metadata_providers:
- name: host
interval: 300
use_v2_api:
series: true
Collect Events
To enable collection of Docker container lifecycle events (start, stop, die) and system events, add DD_EVENT_COLLECTION=true to the agent’s environment:
docker run -d \
--name datadog-agent \
-e DD_API_KEY=kloudfuse \
-e DD_SITE=https://<kloudfuse-hostname> \
-e DD_EVENT_COLLECTION=true \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
datadog/agent:latest
Or in datadog.yaml:
collect_events: true
Collect Logs
Log collection is enabled by default when you set DD_LOGS_ENABLED=true and DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true.
The agent collects logs from all running containers via the Docker log driver.
To collect logs from additional services with file-based log output, mount the service log directory:
docker run -d --name nginx -v /path/to/nginx/logs:/var/log/nginx nginx
See Datadog — Custom Log Collection for file-based collection configuration.
Collect Metrics
Container metrics are collected automatically when the Docker socket is mounted. To collect additional metrics from a service, ensure the service exposes a metrics endpoint:
docker run -d \
--name nginx \
-e DD_AGENT_HOST=datadog-agent \
-e DD_DOGSTATSD_PORT=8125 \
nginx
To enable the OpenMetrics check for Prometheus-style metrics, copy the example configuration:
cp /etc/datadog-agent/conf.d/openmetrics.d/conf.yaml.example \
/etc/datadog-agent/conf.d/openmetrics.d/conf.yaml
See Datadog — OpenMetrics Integration for configuration options.
Collect Traces
APM tracing is enabled when DD_APM_ENABLED=true is set on the agent container.
Instrument your application with the appropriate Datadog tracing library and point it at the agent:
docker run -d \
--name my-app \
-e DD_AGENT_HOST=datadog-agent \
-e DD_TRACE_ENABLED=true \
-e DD_ENV=production \
-e DD_SERVICE=my-service \
-e DD_VERSION=1.0.0 \
my-app:latest
Custom Tags
Add custom tags to all metrics, logs, and events collected by the agent.
Update the environment section of the datadog service in docker-compose.yaml:
services:
datadog:
environment:
- DD_TAGS=custom_tag_name:custom_tag_value
Verify Metrics Are Arriving
-
Confirm the agent container is running:
docker ps --filter name=datadog-agent -
Check the agent status inside the container:
docker exec -it datadog-agent agent status -
In the Kloudfuse UI, click Infrastructure > Hosts. Your Docker host should appear within a few minutes of the agent starting.
-
To verify metrics, open Metrics Explorer and search for
docker.cpu.usage. Filter byhostto scope to your machine.
Troubleshooting
No Metrics Appearing
-
Check the agent logs for connection errors:
docker logs datadog-agent 2>&1 | grep -i "error\|warn\|failed" -
Confirm the
DD_URLenvironment variable points to your Kloudfuse cluster:docker exec -it datadog-agent agent config | grep dd_url -
Confirm the Docker socket is mounted (
/var/run/docker.sock) — without it, the agent cannot collect container-level metrics.