Portainer Templates logo

Portainer Templates

Datadog agent (swarm) Datadog agent (swarm)

Monitoring

Collect events and metrics

Image details

Pulls: 11.3B
Architecture: amd64, arm64
Image size: 339 MB
Latest: 7.82.1-jmx
User: datadog
Created: May 30, 2017
Updated: 2 days ago
Status: active

Configuration

Type
Swarm
Platform
linux
Image
datadog/agent:latest
Volumes
/var/run/docker.sock : /var/run/docker.sock/host/proc/ : /proc//host/sys/fs/cgroup : /sys/fs/cgroup/
Env vars
DD_API_KEY=$API_KEYAPI_KEY=''
Restart
always
Source

Template by portainer·Source

Standalone Install

Select an install method, to see config/commands for deploying Datadog agent (swarm)

Installation method

Install on Portainer

Import all app templates into your Portainer instance, for easy 1-click deploys

  1. Ensure both Docker and Portainer are installed, and up-to-date
  2. Log into your Portainer web UI
  3. Under Settings → App Templates, paste the below URL
  4. Head to Home → App Templates, and the list of apps will show up
  5. Select Datadog agent (swarm), fill in any config options, and hit Deploy

Template Import URL

https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json
Show Me demo
Original stackfile

The swarm stack file this template deploys, straight from its repo:

version: '3'
services:
  datadog-agent:
    image: datadog/agent:latest
    deploy:
      mode: global
      restart_policy:
        condition: any
    environment:
      - DD_API_KEY=$API_KEY
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /proc/:/host/proc/:ro
      - /sys/fs/cgroup/:/host/sys/fs/cgroup:ro

Or deploy it directly from the source:

git clone https://github.com/portainer/templates
cd templates
docker stack deploy -c stacks/datadog-agent/docker-stack.yml datadog-agent-swarm

More install options in our documentation.

Supported architectures and operating systems

  • architectures: amd64 arm64v8
  • operating systems: linux windows (1809, 1909, 2004, 20h2)

Supported versions

Agent 7

The Datadog agent, including a Python 3 interpreter for Python checks.
Relevant tags are:
  • 7 , 7-jmx : use these if you want to track the latest 7 minor release, without breaking change.
  • 7.X.X , 7.X.X-jmx : use these if you want to pin the agent to a precise version (don't forget to upgrade regularly for the latest features).
  • latest , latest-jmx : use these for following the latest agent release, but keep in mind that it will update automatically to the next major release, which will have breaking changes. Major releases are very infrequent (less than one per year).

Agent 6

The Datadog agent, including a Python 2 interpreter for Python checks. Note that Python 2 EOL is set for January 1, 2020.
Relevant tags are:
  • 6 , 6-jmx
  • 6.X.X , 6.X.X-jmx
  • latest-py2 , latest-py2-jmx

Image variants

The agent image comes in two flavors, each one fulfilling a specific use case.

agent:\-jmx

This variant embeds a Java Runtime Environment for JMX-based checks. If you are uncertain about what your needs are, this is probably the one you should use.

agent:\

This variant doesn't embed a Java runtime. If you don't plan on using JMX-based checks, you probably want to pick that one since it is noticeably slimmer.

Documentation

Please refer to:

Support

For issues and help troubleshooting, please contact our support team. If you want to contribute, or think you found a bug in the agent, let's talk on our github repository.

License

View license information for the software contained in this image.
As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).
As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

Check the logs first

Nine times out of ten the logs tell you exactly what went wrong.

  • In Portainer, go to Containers, click the container, then Logs. Or run docker logs <container>
  • Exit codes help too: 137 means killed, usually out of memory. 126 or 127 means the command inside the image is broken.

Permission denied on volumes

If the logs show "permission denied", the app can't write to its data folder on the host.

  • Fix the ownership: sudo chown -R 1000:1000 /proc/ (and the same for the other mapped folders)

Can't reach the Docker socket

datadog-agent talks to Docker through /var/run/docker.sock. If the logs show "permission denied while trying to connect to the Docker daemon socket", the app's user can't access it.

  • Check the socket exists on the host: ls -l /var/run/docker.sock
  • Run the container as root, or add the docker group's id to the container with group_add.

Image won't pull

Test the pull directly on the host: docker pull datadog/agent:latest

  • "manifest unknown" means the tag no longer exists. This template uses latest, so try pinning a specific version instead.
  • "toomanyrequests" is the Docker Hub rate limit. Log in with docker login to raise it.
  • "no space left on device" means a full disk. Reclaim space with docker system prune

"exec format error"

This means the image was built for a different CPU architecture than your server.

  • This image supports: amd64, arm64
  • Check yours with uname -m: x86_64 is amd64, aarch64 is arm64. Raspberry Pi and other ARM boards are the usual culprits.

Container keeps restarting

The always restart policy relaunches the app after every crash, so the real error can scroll past.

  • Check the logs right after a restart, the last few lines before it died are the useful ones.
  • Get the exit code with docker inspect <container> --format '{{.State.ExitCode}}'
  • Still stuck? Redeploy once with the restart policy set to no so the failure stays visible.

Required settings are blank

API_KEY has no default value, and datadog-agent may crash or misbehave if left empty.

  • Fill it in on the deploy screen before hitting deploy.

Stack won't deploy

Compose stacks fail fast on small mistakes, and Portainer shows the reason just above the editor.

  • YAML only accepts spaces for indentation, a single tab breaks the whole file.

Raise an issue

Found something which isn't working as it should? Here's how to report it.

A Swarm stack

Datadog agent (swarm) is a Swarm stack. Swarm is Docker's own way of running apps across more than one machine, so Portainer can spread it over a cluster and move it elsewhere if a server drops out.

The app image

An image is the app packed up ready to go, everything Datadog agent (swarm) needs bundled into one download. This template pulls datadog/agent:latest, which Docker fetches once (about 339 MB) and then starts your own copy from.

Where the image comes from

Docker pulls its images from registries, public libraries of ready-built apps. Datadog agent (swarm)'s comes from Docker Hub, published by datadog.

Version tags

The bit after the colon in the image name is the version tag. Here it's latest, which always points at the newest build, so a redeploy can bump you to a newer release without you asking. Newest right now is 7.82.1-jmx. Pin a specific tag if you would rather stay on one version.

Which machines it runs on

Every image is built for particular CPU types. This one ships for amd64, arm64, so it runs on both regular x86 servers and ARM boards like a Raspberry Pi.

Volumes

A volume is where Datadog agent (swarm) keeps its files so they survive an update or a restart. Without one, anything it saves would sit inside the container and vanish the moment it's recreated. This template mounts:

  • /var/run/docker.sock from /var/run/docker.sock on the host (a socket it talks to, not storage)
  • /host/proc/ from /proc/ on the host
  • /host/sys/fs/cgroup from /sys/fs/cgroup/ on the host

Environment variables

Environment variables are the settings you hand over when you deploy, things like a password or a timezone. Datadog agent (swarm) takes 2 of them, and one needs a value before it'll start properly:

  • DD_API_KEY, defaults to $API_KEY
  • API_KEY, needs a value. Datadog API key

Restart policy

The restart policy here is always, so Docker brings Datadog agent (swarm) back up after a crash and again when the server reboots. Good for anything you want running around the clock. You can change this on the deploy screen. The choices are no (never restart), on-failure (only after a crash), unless-stopped (restart unless you stop it), and always (bring it back no matter what).

Networking

Nothing custom is set, so Datadog agent (swarm) sits on Docker's default bridge network: its own private space that reaches the outside world only through the ports it publishes.

Container name

Once it's deployed, Portainer names the container datadog-agent. That's what you'll spot in the containers list and use in commands like docker logs datadog-agent.

Platform

The platform is linux, the kind of system the container is built to run on. Docker and Portainer handle this on a normal Linux server.

Portainer app templates

Zooming out, this whole page comes from a Portainer app template: a short recipe telling Portainer how to set Datadog agent (swarm) up. Add the template list to Portainer once, then deploying Datadog agent (swarm) is a click rather than a wall of config.