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. DD_DD_URL redirects metrics only — logs (DD_LOGS_CONFIG_LOGS_DD_URL) and APM traces (DD_APM_DD_URL) must be set separately, or those signals are sent to Datadog’s default intake instead of Kloudfuse. Note that the logs and APM endpoints use the <host>:443 host:port form, while the metrics DD_DD_URL uses the full https://<host>; URL.

Add DD_SKIP_SSL_VALIDATION=true if the cluster presents a self-signed or expired TLS certificate. For anything beyond a quick smoke test, prefer the Docker Compose path below, which keeps this configuration in a datadog.yaml file.

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
yaml

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
yaml

Create the Dockerfile

Create a datadog/Dockerfile that adds the configuration to the official agent image:

FROM gcr.io/datadoghq/agent:7

ADD datadog.yaml /etc/datadog-agent/datadog.yaml

Build and Deploy

Build the agent image and start the deployment:

docker-compose build
docker-compose up -d

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
yaml

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
yaml

Verify Metrics Are Arriving

  1. Confirm the agent container is running:

    docker ps --filter name=datadog-agent
  2. Check the agent status inside the container:

    docker exec -it datadog-agent agent status
  3. In the Kloudfuse UI, click Infrastructure > Hosts. Your Docker host should appear within a few minutes of the agent starting.

  4. To verify metrics, open Metrics Explorer and search for docker.cpu.usage. Filter by host to scope to your machine.

Troubleshooting

No Metrics Appearing

  1. Check the agent logs for connection errors:

    docker logs datadog-agent 2>&1 | grep -i "error\|warn\|failed"
  2. Confirm the DD_URL environment variable points to your Kloudfuse cluster:

    docker exec -it datadog-agent agent config | grep dd_url
  3. Confirm the Docker socket is mounted (/var/run/docker.sock) — without it, the agent cannot collect container-level metrics.

Logs Not Appearing

  1. Confirm DD_LOGS_ENABLED=true and DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true are set in the agent environment.

  2. Verify the agent log config points to Kloudfuse:

    docker exec -it datadog-agent agent config | grep logs_dd_url