---
title: Single Step APM Instrumentation on Docker
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > APM > Application Instrumentation > Single Step APM Instrumentation >
  Single Step APM Instrumentation on Docker
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Single Step APM Instrumentation on Docker

## Overview{% #overview %}

In a Docker Linux container, use Single Step Instrumentation (SSI) for APM to install the Datadog Agent and [instrument](https://docs.datadoghq.com/tracing/glossary.md#instrumentation) your applications in one step, with no additional configuration required.

Install the `dd-apm` skill in your AI coding agent for guided APM setup. Run this command:

```shell
npx skills add https://github.com/datadog-labs/agent-skills --skill dd-apm --full-depth -y
```

## Enable APM on your applications{% #enable-apm-on-your-applications %}

{% alert level="info" %}
Before proceeding, confirm that your environment is compatible by reviewing the [SSI compatibility guide.](https://docs.datadoghq.com/tracing/trace_collection/automatic_instrumentation/single-step-apm/compatibility.md)
{% /alert %}

To install the Datadog Agent and enable SSI in a Docker Linux environment, run the following commands on your Docker host (not inside an application container).

1. Install the Docker instrumentation components without installing a host Agent:

   ```shell
   DD_APM_INSTRUMENTATION_ENABLED=docker \
   DD_NO_AGENT_INSTALL=true \
   bash -c "$(curl -L https://install.datadoghq.com/scripts/install_script_agent7.sh)"
   ```

1. Run or redeploy the Agent container. Replace `<YOUR_DD_API_KEY>` with your [Datadog API key](https://app.datadoghq.com/organization-settings/api-keys):

   ```shell
   docker run -d --name dd-agent \
     -e DD_API_KEY=<YOUR_DD_API_KEY> \
     -e DD_SITE="<YOUR_DATADOG_SITE>" \
     -e DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true \
     -e DD_APM_ENABLED=true \
     -e DD_APM_NON_LOCAL_TRAFFIC=true \
     -e DD_APM_RECEIVER_SOCKET=/var/run/datadog/apm.socket \
     -e DD_DOGSTATSD_SOCKET=/var/run/datadog/dsd.socket \
     -v /var/run/datadog:/var/run/datadog \
     -v /var/run/docker.sock:/var/run/docker.sock:ro \
     -v /proc/:/host/proc/:ro \
     -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
     -v /var/lib/docker/containers:/var/lib/docker/containers:ro \
     registry.datadoghq.com/agent:7
   ```

**Note**: Run only one Datadog Agent per node. If a Datadog Agent container already exists, update its definition (or your Docker Compose file) with these settings and recreate it, rather than starting a second Agent. For rootless Docker, set the correct Docker socket in `docker_config.yaml`.

1. Recreate your application containers.

Instrumentation is applied when a container is created, so restarting an existing container with `docker stop` and `docker start` does not instrument it. Remove your application containers and run them again.

{% alert level="info" %}
SSI adds a small amount of startup time to instrumented applications. If this overhead is not acceptable for your use case, contact [Datadog Support](https://docs.datadoghq.com/help/).
{% /alert %}

### Generate the command from Datadog{% #generate-the-command-from-datadog %}

To get a command pre-filled with your API key and site, go to the [Install the Datadog Agent on Docker](https://app.datadoghq.com/fleet/install-agent/latest?platform=docker) page. In the Customize my agent install command section, go to Additional configuration > Application Observability, and turn on APM Instrumentation. Then copy and run the generated command.

{% image
   source="https://docs.dd-static.net/images/tracing/trace_collection/docker-apm-instrumentation-toggle.938c8ca3f7550fba24ac50a6c4f8062d.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/tracing/trace_collection/docker-apm-instrumentation-toggle.938c8ca3f7550fba24ac50a6c4f8062d.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="The 'Customize your agent install command' section of in-app instructions for installing the Datadog Agent on Docker" /%}

## Set SDK tracer versions{% #set-sdk-tracer-versions %}

By default, Single Step Instrumentation installs the latest major versions of the Datadog SDKs, and applies minor updates automatically when they become available.

To pin specific versions, add the `DD_APM_INSTRUMENTATION_LIBRARIES` variable with comma-separated `language:major` pairs to the component installation command. Available versions are listed in the source repositories for each language:

- [Java](https://github.com/DataDog/dd-trace-java/releases) (`java`)
- [Node.js](https://github.com/DataDog/dd-trace-js/releases) (`js`)
- [Python](https://github.com/DataDog/dd-trace-py/releases) (`python`)
- [.NET](https://github.com/DataDog/dd-trace-dotnet/releases) (`dotnet`)
- [Ruby](https://github.com/DataDog/dd-trace-rb/releases) (`ruby`)
- [PHP](https://github.com/DataDog/dd-trace-php/releases) (`php`)

You can also select versions from dropdowns in Datadog: on the [Install the Datadog Agent on Docker](https://app.datadoghq.com/fleet/install-agent/latest?platform=docker) page, after you turn on APM Instrumentation, click Customize library versions.

{% image
   source="https://docs.dd-static.net/images/tracing/trace_collection/apm-instrumentation-version-pinning.5d47edec7389b8d323467110fa5ac203.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/tracing/trace_collection/apm-instrumentation-version-pinning.5d47edec7389b8d323467110fa5ac203.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="The 'Customize library versions' drop-down in the instructions for installing the Datadog Agent on Docker" /%}

## Verify the installation{% #verify-the-installation %}

1. Confirm the Docker daemon is using the Datadog runtime:

   ```shell
   docker system info --format '{{.DefaultRuntime}}'
   ```

The output must be `dd-shim`. If it is `runc` or anything else, the instrumentation components did not install successfully, and your applications are not instrumented regardless of whether the Agent is healthy. Re-run the installation command, and confirm that the Docker daemon was running when you ran it.

1. Confirm the Agent container is running:

   ```shell
   docker ps --filter name=dd-agent
   ```

1. Confirm the Agent is healthy and the APM Agent is running:

   ```shell
   docker exec dd-agent agent status
   ```

Check the **APM Agent** section of the output.

1. Confirm that an application container is using the Datadog runtime. Replace `<CONTAINER_NAME>` with the name of one of your application containers:

   ```shell
   docker inspect <CONTAINER_NAME> --format '{{.HostConfig.Runtime}}'
   ```

1. After your applications receive traffic, confirm your services appear on the [APM Services page](https://app.datadoghq.com/apm/services). If they don't appear within a few minutes, follow the [SSI troubleshooting guide](https://docs.datadoghq.com/tracing/trace_collection/automatic_instrumentation/single-step-apm/troubleshooting.md).

## Configure Unified Service Tags{% #configure-unified-service-tags %}

Unified Service Tags (USTs) apply consistent tags across traces, metrics, and logs, making it easier to navigate and correlate your observability data. Learn how to [set USTs for Docker services](https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging.md?tab=docker#containerized-environment).

## Enable SDK-dependent products and features{% #enable-sdk-dependent-products-and-features %}

After SSI loads the Datadog SDK into your applications and enables distributed tracing, you can configure additional products that rely on the SDK:

| Product                                                                                                             | Environment variable                 |
| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| [Runtime Metrics](https://docs.datadoghq.com/tracing/metrics/runtime_metrics.md)                                    | `DD_RUNTIME_METRICS_ENABLED`         |
| [Log Injection](https://docs.datadoghq.com/tracing/other_telemetry/connect_logs_and_traces.md)                      | `DD_LOGS_INJECTION`                  |
| [Continuous Profiler](https://docs.datadoghq.com/profiler.md)                                                       | `DD_PROFILING_ENABLED`               |
| [Data Streams Monitoring](https://docs.datadoghq.com/data_streams.md)                                               | `DD_DATA_STREAMS_ENABLED`            |
| [App and API Protection](https://docs.datadoghq.com/security/application_security.md)                               | `DD_APPSEC_ENABLED`                  |
| [Runtime Code Analysis (IAST)](https://docs.datadoghq.com/security/code_security/iast.md)                           | `DD_IAST_ENABLED`                    |
| [Dynamic Instrumentation](https://docs.datadoghq.com/tracing/trace_collection/dynamic_instrumentation.md)           | `DD_DYNAMIC_INSTRUMENTATION_ENABLED` |
| [Data Jobs Monitoring](https://docs.datadoghq.com/data_jobs.md)                                                     | `DD_DATA_JOBS_ENABLED`               |
| [Software Composition Analysis](https://docs.datadoghq.com/security/code_security/software_composition_analysis.md) | `DD_APPSEC_SCA_ENABLED`              |

**Note**: All variables accept `true` or `false`. `DD_PROFILING_ENABLED` also accepts `auto`, which profiles only eligible processes and is recommended for SSI.

To enable products, [set environment variables](https://docs.datadoghq.com/tracing/trace_collection/library_config.md) in your application configuration.

## Remove Single Step APM instrumentation from your Agent{% #remove-single-step-apm-instrumentation-from-your-agent %}

If you don't want to collect trace data for a particular service, host, VM, or container, complete the following steps:

### Remove instrumentation for specific services{% #remove-instrumentation-for-specific-services %}

To remove APM instrumentation and stop sending traces from a specific service:

1. Add the `DD_INSTRUMENT_SERVICE_WITH_APM` environment variable to the service startup command:
   ```shell
   docker run -e DD_INSTRUMENT_SERVICE_WITH_APM=false <service_start_command>
   ```
1. Restart the service.

### Remove APM for all services on the infrastructure{% #remove-apm-for-all-services-on-the-infrastructure %}

To stop producing traces, uninstall APM and restart the infrastructure:

1. Run:
   ```shell
   dd-container-install --uninstall
   ```
1. Restart Docker:
   ```shell
   systemctl restart docker
   ```
Or use the equivalent for your environment.

## Troubleshooting{% #troubleshooting %}

If you encounter problems enabling APM with SSI, see the [SSI troubleshooting guide](https://docs.datadoghq.com/tracing/trace_collection/automatic_instrumentation/single-step-apm/troubleshooting.md).

## Further reading{% #further-reading %}

Additional helpful documentation, links, and articles:

- [Enable Runtime Metrics](https://docs.datadoghq.com/tracing/metrics/runtime_metrics.md)
