Setting up .NET tracing on Docker with Instana base images
Use Instana .NET base images with a built-in tracing agent to simplify tracing setup in containerized .NET applications.
Instana .NET base images are preconfigured Docker images based on Microsoft's official .NET runtime images. They include the Instana tracing agent and come with instrumentation already installed and configured.
For manual setup, see Manually setting up .NET tracing on Docker.
Key features
The Instana .NET base images include:
- Preinstalled Instana .NET Core Tracer
- Preconfigured profiler environment variables
- Multi-architecture support (amd64 and arm64)
- Multiple OS variants (Alpine, Ubuntu Noble, and Ubuntu Resolute)
- .NET 10.0 runtime support
- Zero-code instrumentation ready
Prerequisites
Before you use Instana .NET base images, ensure that the following prerequisites are met:
- Docker is installed and running on your system.
- You have your Instana agent key and endpoint URL.
Using base images for .NET tracing
To use Instana .NET base images in your containerized application, complete the following steps:
- Choose the appropriate base image variant for your application. See Available image variants for options.
- Update your Dockerfile to use the Instana base image:
FROM artifact-public.instana.io/dotnet-tracers/dotnet-runtime-10.0-{variant}-{architecture}:{version}Replace {variant} and {architecture} with the appropriate values for your environment. For the {version} tag, use
latestto get the most recent image version or a specific version (for example,1.319.7) to pin to a particular release. For more information, see Architecture support and Image naming conventions sections.
Your application runs with Instana tracing enabled and automatically sends trace data to Instana.
Example 1: Simple ASP.NET Core application
The following example shows a simple ASP.NET Core application using the Instana base image:
Dockerfile:
# Use Instana base image with specific version
FROM artifact-public.instana.io/dotnet-tracers/dotnet-runtime-10.0-alpine-amd64:1.319.7
# Copy published application
COPY ./publish /app
# Set entrypoint
ENTRYPOINT ["dotnet", "MyApp.dll"]
Build and run:
# Build your application
dotnet publish -c Release -o ./publish
# Build Docker image
docker build -t myapp:latest .
# Run with Instana configuration
docker run -d \
-e INSTANA_AGENT_KEY="your-instana-agent-key" \
-e INSTANA_ENDPOINT_URL="serverless-end-point-url" \
-e INSTANA_SERVICE_NAME=my-service \
-p 8080:8080 \
myapp:latest
Example 2: Multi-stage build with SDK
The following example demonstrates a multi-stage Dockerfile:
Dockerfile:
# Build stage
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY ["MyApp.csproj", "./"]
RUN dotnet restore
COPY . .
RUN dotnet publish -c Release -o /app/publish
# Runtime stage with Instana (using specific version)
FROM artifact-public.instana.io/dotnet-tracers/dotnet-runtime-10.0-noble-arm64:1.319.7
# Or use latest tag to get the most recent version
# FROM artifact-public.instana.io/dotnet-tracers/dotnet-runtime-10.0-noble-arm64:latest
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "MyApp.dll"]
Build and run:
# Build Docker image (this also builds your application)
docker build -t myapp:latest .
# Run with Instana configuration
docker run -d \
-e INSTANA_AGENT_KEY="your-instana-agent-key" \
-e INSTANA_ENDPOINT_URL="serverless-end-point-url" \
-e INSTANA_SERVICE_NAME=my-service \
-p 8080:8080 \
myapp:latest
Example 3: Docker Compose with multiple services
The following example shows how to use Docker Compose to run multiple services with Instana tracing:
docker-compose.yml:
version: '3.8'
services:
api-service:
build:
context: ./api
dockerfile: Dockerfile
image: myapp-api:latest
environment:
- INSTANA_ENDPOINT_URL=serverless-end-point-url
- INSTANA_AGENT_KEY=your-instana-agent-key
- INSTANA_SERVICE_NAME=api-service
ports:
- "8080:8080"
worker-service:
build:
context: ./worker
dockerfile: Dockerfile
image: myapp-worker:latest
environment:
- INSTANA_ENDPOINT_URL=serverless-end-point-url
- INSTANA_AGENT_KEY=your-instana-agent-key
- INSTANA_SERVICE_NAME=worker-service
Start services:
docker-compose up -d
Configuration values:
Replace the following values in your configuration:
your-instana-agent-key: Your Instana agent keyserverless-end-point-url: Your Instana endpoint URLmy-serviceor service names: Your service name
Why use Instana .NET base images
Without base images, you need to:
- Manually download Instana NuGet packages in your Dockerfiles
- Configure complex environment variables for the CLR profiler
- Handle architecture-specific profiler binaries (amd64 vs arm64)
- Manage different profiler builds for Alpine (musl-libc) vs Ubuntu (glibc)
- Repeat this setup across multiple microservices
With Instana .NET Base Images, you can use preconfigured images that work out of the box.
Base image details
You can choose from three different base images depending on your needs.
Available image variants
The following table summarizes the available Instana .NET base images:
| Variant | Base image | C library | Use case | Size |
|---|---|---|---|---|
| Alpine | mcr.microsoft.com/dotnet/aspnet:10.0-alpine3.23 |
musl-libc | Minimal containers, size-optimized | 110 MB |
| Noble | mcr.microsoft.com/dotnet/aspnet:10.0-noble |
glibc | Ubuntu 24.04 LTS (Noble Numbat) | 220 MB |
| Resolute | mcr.microsoft.com/dotnet/aspnet:10.0-resolute |
glibc | Ubuntu 25.04 (Resolute Ringtail) | 220 MB |
Architecture support
Each variant supports:
- amd64 (x86_64): Standard Intel or AMD processors
- arm64 (aarch64): ARM processors (Apple Silicon, AWS Graviton, and other processors)
Image naming conventions
The image name follows this pattern:
{registry}/dotnet-runtime-10.0-{variant}-{architecture}:{version}
Version tag options:
- Use
latestto automatically get the most recent image version - Use a specific version number (for example,
1.319.7) to pin to a particular release
Examples with specific version:
artifact-public.instana.io/dotnet-tracers/dotnet-runtime-10.0-alpine-amd64:1.319.7artifact-public.instana.io/dotnet-tracers/dotnet-runtime-10.0-noble-arm64:1.319.7artifact-public.instana.io/dotnet-tracers/dotnet-runtime-10.0-resolute-amd64:1.319.7
Examples with latest tag:
artifact-public.instana.io/dotnet-tracers/dotnet-runtime-10.0-alpine-amd64:latestartifact-public.instana.io/dotnet-tracers/dotnet-runtime-10.0-noble-arm64:latestartifact-public.instana.io/dotnet-tracers/dotnet-runtime-10.0-resolute-amd64:latest
Directory structure
The base images include the following directory structure:
/opt/instana/
├── lib/
│ └── Instana.Tracing.Core.dll # Managed tracer library
└── profiler/
├── CoreProfiler.so # Native profiler (architecture-specific)
└── instrumentation.json # Instrumentation configuration
Preconfigured environment variables
All base images include the following preconfigured environment variables:
| Variable | Value | Purpose |
|---|---|---|
| CORECLR_ENABLE_PROFILING | 1 |
Enables CLR profiling |
| CORECLR_PROFILER | {CF0D821E-299B-5307-A3D8-B283C03916DD} |
Instana profiler GUID |
| CORECLR_PROFILER_PATH | /opt/instana/profiler/CoreProfiler.so | Path to native profiler |
| DOTNET_STARTUP_HOOKS | /opt/instana/lib/Instana.Tracing.Core.dll | Managed tracer startup hook |
Benefits
The base images provide significant advantages over manual setup:
- Zero manual configuration: No need to install NuGet packages or set environment variables
- Consistent setup: Same configuration across all environments
- Reduced errors: Eliminates common configuration mistakes
- Faster deployment: Preconfigured images speed up container startup
- Multi-architecture support: Single Dockerfile works across different CPU architectures
- Simplified maintenance: Updates managed centrally by Instana