Public Repository

Last pushed: 2 years ago
Short Description
Our Datadog Agent with DD_URL as an ENV var
Full Description

Datadog Agent Dockerfile

This repository is meant to build the base image for a Datadog Agent container. You will have to use the resulting image to configure and run the Agent.

Quick Start

The default image is ready-to-go. You just need to set your hostname and API_KEY in the environment.

docker run -d --name dd-agent -h `hostname` -v /var/run/docker.sock:/var/run/docker.sock -v /proc/mounts:/host/proc/mounts:ro -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro -e API_KEY={your_api_key_here} datadog/docker-dd-agent

If you are running on Amazon Linux, use the following instead:

docker run -d --name dd-agent -h hostname -v /var/run/docker.sock:/var/run/docker.sock -v /proc/mounts:/host/proc/mounts:ro -v /cgroup/:/host/sys/fs/cgroup:ro -e API_KEY={your_api_key_here}


Environment variables

A few parameters can be changed with environment variables.

  • TAGS set host tags. Add -e TAGS="mytag0,mytag1" to use [mytag0, mytag1] as host tags.
  • LOG_LEVEL set logging verbosity (CRITICAL, ERROR, WARNING, INFO, DEBUG). Add -e LOG_LEVEL=DEBUG to turn logs to debug mode.
  • PROXY_HOST, PROXY_PORT, PROXY_USER and PROXY_PASSWORD set the proxy configuration.
  • DD_URL set the Datadog intake server to send Agent data to (used when using an agent as a proxy )

Build an image

To configure integrations or custom checks, you will need to build a Docker image on top of this image.

  1. Create a Dockerfile to set your specific configuration or to install dependencies.

     FROM datadog/docker-dd-agent
     # Example: MySQL
     ADD conf.d/mysql.yaml /etc/dd-agent/conf.d/mysql.yaml
  2. Build it.

    docker build -t dd-agent-image .

  3. Then run it like the datadog/docker-dd-agent image.

     docker run -d --name dd-agent -h `hostname` -v /var/run/docker.sock:/var/run/docker.sock -v /proc/mounts:/host/proc/mounts:ro -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro -e API_KEY={your_api_key_here} dd-agent-image
  4. It's done!

You can find some examples in our Github repository.


To display information about the Agent's state with this command.

docker exec dd-agent service datadog-agent info

Warning: the docker exec command is available only with Docker 1.3 and above.


Copy logs from the container to the host

That's the simplest solution. It imports container's log to one's host directory.

docker cp dd-agent:/var/log/datadog /tmp/log-datadog-agent

Supervisor logs

Basic information about the Agent execution are available through the logs command.

docker logs dd-agent


Standalone DogStatsD

To run DogStatsD without the full Agent, add the command dogstatsd at the end of the docker run command.

docker run -d --name dogstatsd -h `hostname` -v /var/run/docker.sock:/var/run/docker.sock -v /proc/mounts:/host/proc/mounts:ro -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro -e API_KEY={your_api_key_here} datadog/docker-dd-agent dogstatsd

Usage commands work, but we added simpler ones when DogStatsD is running on its own.

To display dogstatsd-only information.

docker exec dogstatsd dogstatsd info

To display dogstatsd-only logs.

docker logs dogstatsd

DogStatsD from the host

DogStatsD can be available on port 8125 from anywhere by adding the option -p 8125:8125/udp to the docker run command.

To make it available from your host only, use -p instead.

DogStatsD from other containers

Using Docker links

To send data to DogStatsD from other containers, add a --link dogstatsd:dogstatsd option to your run command.

For example, run a container my_container with the image my_image.

docker run  --name my_container           \
            --all_your_flags              \
            --link dogstatsd:dogstatsd    \

DogStatsD address and port will be available in my_container's environment variables DOGSTATSD_PORT_8125_UDP_ADDR and DOGSTATSD_PORT_8125_UDP_PORT.

Using Docker host IP

Since the Agent container port 8125 should be linked to the host directly, you can connect to DogStatsD though the host. By default, the IP of the host in a Docker container is So you can configure your DogStatsD client to connect to


Docker isolates containers from the host. As a result, the Agent won't have access to all host metrics.

Known missing/incorrect metrics:

  • Network
  • Process list

Also, several integrations might be incomplete. See the "Contribute" section.

Docker Pull Command