Note: The Docker Daemon check is still maintained but only works with Agent v5.
Configure this Agent check to get metrics from the Docker_daemon service in real time to:
- Visualize and monitor Docker_daemon states.
- Be notified about Docker_daemon failovers and events.
To collect Docker metrics about all your containers, run one Datadog Agent on every host. There are two ways to run the Agent: directly on each host, or within a docker-dd-agent container (recommended).
For either option, your hosts need cgroup memory management enabled for the Docker check to succeed. See the docker-dd-agent repository for how to enable it.
- Ensure Docker is running on the host.
- Install the Agent as described in the Agent installation instructions for your host OS.
- Enable the Docker integration tile in the application.
- Add the Agent user to the Docker group:
usermod -a -G docker dd-agent
- Create a
docker_daemon.yaml
file by copying the example file in the Agent conf.d directory. If you have a standard install of Docker on your host, there shouldn't be anything you need to change to get the integration to work. - To enable other integrations, use
docker ps
to identify the ports used by the corresponding applications.
-
Ensure Docker is running on the host.
-
As per the Docker container installation instructions, run:
docker run -d --name dd-agent \ -v /var/run/docker.sock:/var/run/docker.sock:ro \ -v /proc/:/host/proc/:ro \ -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \ -e API_KEY={YOUR_DD_API_KEY} \ datadog/docker-dd-agent:latest
In the command above, you are able to pass your API key to the Datadog Agent using Docker's -e
environment variable flag. Other variables include:
Variable | Description |
---|---|
API_KEY | Sets your Datadog API key. |
DD_HOSTNAME | Sets the hostname in the Agent container's datadog.conf file. If this variable is not set, the Agent container defaults to using the Name field (as reported by the docker info command) as the Agent container hostname. |
DD_URL | Sets the Datadog intake server URL where the Agent sends data. This is useful when using the Agent as a proxy. |
LOG_LEVEL | Sets logging verbosity (CRITICAL, ERROR, WARNING, INFO, DEBUG). For example, -e LOG_LEVEL=DEBUG sets logging to debug mode. |
TAGS | Sets host tags as a comma delimited string. Both simple tags and key-value tags are available, for example: -e TAGS="simple-tag, tag-key:tag-value" . |
EC2_TAGS | Enabling this feature allows the Agent to query and capture custom tags set using the EC2 API during startup. To enable, use -e EC2_TAGS=yes . Note: This feature requires an IAM role associated with the instance. |
NON_LOCAL_TRAFFIC | Enabling this feature allows StatsD reporting from any external IP. To enable, use -e NON_LOCAL_TRAFFIC=yes . This is used to report metrics from other containers or systems. See network configuration for more details. |
PROXY_HOST, PROXY_PORT, PROXY_USER, PROXY_PASSWORD | Sets proxy configuration details. Note: PROXY_PASSWORD is required for passing in an authentication password and cannot be renamed. For more information, see the Agent proxy documentation. |
SD_BACKEND, SD_CONFIG_BACKEND, SD_BACKEND_HOST, SD_BACKEND_PORT, SD_TEMPLATE_DIR, SD_CONSUL_TOKEN | Enables and configures Autodiscovery. For more information, see the Autodiscovery guide. |
Note: Add --restart=unless-stopped
if you want your agent to be resistant to restarts.
To run the Datadog Agent container on Amazon Linux, make this change to the cgroup
volume mount location:
docker run -d --name dd-agent \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /proc/:/host/proc/:ro \
-v /cgroup/:/host/sys/fs/cgroup:ro \
-e API_KEY={YOUR API KEY} \
datadog/docker-dd-agent:latest
The standard Docker image is based on Debian Linux, but as of Datadog Agent v5.7, there is an Alpine Linux based image. The Alpine Linux image is considerably smaller in size than the traditional Debian-based image. It also inherits Alpine's security-oriented design.
To use the Alpine Linux image, append -alpine
to the version tag. For example:
docker run -d --name dd-agent \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /proc/:/host/proc/:ro \
-v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
-e API_KEY={YOUR API KEY} \
datadog/docker-dd-agent:latest-alpine
Starting with version 5.5.0 of the Datadog Agent, the Docker image follows a new versioning pattern. This allows Datadog to release changes to the Docker image of the Datadog Agent but with the same version of the Agent.
The Docker image version has the following pattern: X.Y.Z where X is the major version of the Docker image, Y is the minor version, Z represents the Agent version.
For example, the first version of the Docker image that bundles the Datadog Agent 5.5.0 is: 10.0.550
For more information about building custom Docker containers with the Datadog Agent, the Alpine Linux based image, versioning, and more, reference the docker-dd-agent project on Github.
Run the Agent's status subcommand and look for docker_daemon
under the Checks section.
The latest Docker check is named docker
and written in Go to take advantage of the new internal architecture. Starting from v6.0, the Agent doesn't load the docker_daemon
check anymore, even if it is still available and maintained for Agent v5. All features are ported on version >6.0 , except the following deprecations:
- The
url
,api_version
andtags*
options are deprecated. Direct use of the standard Docker environment variables is encouraged. - The
ecs_tags
,performance_tags
andcontainer_tags
options are deprecated. Every relevant tag is collected by default. - The
collect_container_count
option to enable thedocker.container.count
metric is not supported.docker.containers.running
and.stopped
should be used.
Some options have moved from docker_daemon.yaml
to the main datadog.yaml
:
collect_labels_as_tags
has been renameddocker_labels_as_tags
and supports high cardinality tags. See the details indatadog.yaml.example
.exclude
andinclude
lists have been renamedac_include
andac_exclude
. To make filtering consistent across all components of the Agent, filtering on arbitrary tags has been dropped. The only supported filtering tags areimage
(image name) andname
(container name). Regexp filtering is still available, seedatadog.yaml.example
for examples.- The
docker_root
option has been split in two options:container_cgroup_root
andcontainer_proc_root
. exclude_pause_container
has been added to exclude paused containers on Kubernetes and Openshift (defaults to true). This avoids removing them from the exclude list by error.
Additional changes:
- The
TAGS
environment variable was renamed toDD_TAGS
. - The Docker Hub repository has changed from datadog/docker-dd-agent to datadog/agent.
The import
command converts the old docker_daemon.yaml
to the new docker.yaml
. The command also moves needed settings from docker_daemon.yaml
to datadog.yaml
.
See metadata.csv for a list of metrics provided by this integration.
The Docker integration produces the following events:
- Delete Image
- Die
- Error
- Fail
- Kill
- Out of memory (oom)
- Pause
- Restart container
- Restart Daemon
- Update
See service_checks.json for a list of service checks provided by this integration.
Note: To use docker.exit
, add collect_exit_codes: true
in your Docker YAML file and restart the Agent.
Need help? Contact Datadog support.