Build Datadog Agent image
Follow the instructions below to build the Datadog Docker Agent image for a given <AGENT_VERSION>
Agent version (above v6.0).
Clone the Datadog Agent repository:
git clone https://github.com/DataDog/datadog-agent.git
Go into the datadog-agent/Dockerfiles/agent/
folder:
cd datadog-agent/Dockerfiles/agent/
Switch to the Agent version branch you want to build the Agent from:
git branch <AGENT_VERSION> && git checkout <AGENT_VERSION>
Download the Agent Debian package that corresponds to the Agent version you want. Choose between the AMD and ARM architecture:
curl https://s3.amazonaws.com/apt.datadoghq.com/pool/d/da/datadog-agent_<AGENT_VERSION>-1_amd64.deb -o datadog-agent_<AGENT_VERSION>-1_amd64.deb
curl https://s3.amazonaws.com/apt.datadoghq.com/pool/d/da/datadog-agent_<AGENT_VERSION>-1_arm64.deb -o datadog-agent_<AGENT_VERSION >-1_arm64.deb
For
Agent ≥ 7.44 – the build Dockerfile expects a
data.tar.xz archive. As such, do one of the following:
- download the release tarball
datadog-agent_<AGENT_VERSION>-<ARCH>.tar.xz
(<ARCH>
= amd64 or arm64)
OR
- extract the data payload from the
.deb
with ar -x datadog-agent_<AGENT_VERSION>-<ARCH>.deb # produces data.tar.xz
and pass data.tar.xz
to DD_AGENT_ARTIFACT
.
Note: The full list of Debian packages available can be found on this APT listing.
Build the Agent image by running:
docker build --build-arg <BUILD_ARGS> --file amd64/Dockerfile --pull --tag <IMAGE_TAG> .
docker build --build-arg <BUILD_ARGS> --file arm64/Dockerfile --pull --tag <IMAGE_TAG> .
For instance to build the Agent version 7.17.0 on the AMD architecture you would run:
docker build --build-arg DD_AGENT_ARTIFACT=./datadog-agent_7.17.0-1_amd64.deb --file amd64/Dockerfile --pull --tag documentation-example .
For Agent ≥ 7.44 - recent Agent tags ship a single multi-arch Dockerfile. For your command:- use
--file Dockerfile
- remove the leading
./
in DD_AGENT_ARTIFACT
and - point to the
*.tar.xz
file from Step 4.
# Agent ≥ 7.44 example
docker build \
--build-arg DD_AGENT_ARTIFACT=datadog-agent_<AGENT_VERSION>-<ARCH>.tar.xz \
--file Dockerfile \
--pull \
--tag dd-agent:<AGENT_VERSION> .
Available <BUILD_ARGS>
are:
Argument | Definition | Default |
---|
PYTHON_VERSION | The Python runtime version for your Agent check. | - |
WITH_JMX | If set to true , the Agent container contains the JMX fetch logic. | false |
DD_AGENT_ARTIFACT | Path to the Agent Debian artifact package to use if not in the same folder. | - |