Logging is here!

Tracing Docker Applications

Enable the datadog-trace-agent in the datadog/agent container by passing DD_APM_ENABLED=true as an environment variable.

Note: APM is NOT available on Alpine Images

For additional information, see the Agent 6 Docker documentation.

Tracing from the host

Tracing is available on port 8126/tcp from any host by adding the option -p 8126:8126/tcp to the docker run command.

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

For example, the following command allows the Agent to receive traces from anywhere:

docker run -d -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 DD_API_KEY=<YOUR_API_KEY> \
              -e DD_APM_ENABLED=true \

Tracing from other containers

As with DogStatsD, traces can be submitted to the Agent from other containers either using Docker networks or with the Docker host IP.

Docker Network

As a first step, create a user-defined bridge network:

docker network create <NETWORK_NAME>

Then start the Agent and the application container, connected to the network previously created:

# Datadog Agent
docker run -d --name dd-agent \
              --network <NETWORK_NAME> \
              -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 DD_API_KEY=<YOUR_API_KEY> \
              -e DD_APM_ENABLED=true \

# Application
docker run -d --name app \
              --network <NETWORK_NAME> \

This exposes the hostname dd-agent in your app container.
If you’re using docker-compose, <NETWORK_NAME> parameters are the ones defined under the networks section of your docker-compose.yml.

Your application tracers must be configured to submit traces to this address. See the examples below for each supported language:


from ddtrace import tracer



Datadog.configure do |c|
  c.tracer hostname: 'dd-agent',
           port: 8126


import ddtrace "github.com/DataDog/dd-trace-go/opentracing"

func main() {
    config := ddtrace.NewConfiguration()
    config.AgentHostname = "dd-agent"
    config.AgentPort = "8126"

    tracer, closer, err := ddtrace.NewTracer(config)
    defer closer.Close()


Either update the Java Agent configuration via environment variables:

DD_AGENT_HOST=dd-agent \
java -javaagent:/path/to/the/dd-java-agent.jar -jar /your/app.jar

or via system properties:

java -javaagent:/path/to/the/dd-java-agent.jar \
     -Ddd.agent.host=dd-agent \
     -Ddd.agent.port=8126 \
     -jar /your/app.jar

Docker host IP

Agent container port 8126 should be linked to the host directly.
Configure your application tracer to report to the default route of this container (determine this using the ip route command).

The following is an example for the Python Tracer, assuming is the default route:

from ddtrace import tracer

tracer.configure(hostname='', port=8126)

Further Reading

Additional helpful documentation, links, and articles: