Install the APM Insight .NET agent on Docker Containers
Installing the .NET agent in a Docker container is the same as installing the standard .NET agent in Windows. You need to configure the DockerFile to perform the installation.
Install the .NET agent on a Windows Docker container
Below is an example of configuring the .NET agent on a Windows Docker container.
FROM mcr.microsoft.com/dotnet/framework/aspnet
# Publish your application
COPY your app to be published /inetpub/wwwroot
# Download the APM Insight .NET agent installer
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;\
Invoke-WebRequest "https://staticdownloads.site24x7.com/apminsight/agents/apminsight-dotnetagent.msi" -UseBasicParsing -OutFile "apminsight-dotnetagent.msi"
# Install the APM Insight .NET agent
RUN Start-Process -Wait -FilePath msiexec -ArgumentList /i, "apminsight-dotnetagent.msi", /qn, editconfig=false, useappfilters=false, license.key=YOUR_LICENSE_KEY
# Remove the APM Insight .NET agent installer
RUN Remove-Item "apminsight-dotnetagent.msi"
# Set your application name
ENV SITE24X7_APP_NAME=YOUR_APP_NAME
Install the .NET agent on a Linux Docker container
Below is an example of configuring the .NET agent on a Linux Docker container.
# Use Linux-based ASP.NET runtime image FROM mcr.microsoft.com/dotnet/aspnet:6.0 # Set working directory WORKDIR /app # Copy your published app COPY your_app_published_folder/ . # replace with your actual published app folder path # Use wget to download and install APM Insight agent RUN apt-get update && \ apt-get install -y wget ca-certificates unzip && \ wget https://staticdownloads.site24x7.com/apminsight/agents/dotnet/apminsight-dotnetcoreagent-linux.sh && \ chmod +x apminsight-dotnetcoreagent-linux.sh && \ ./apminsight-dotnetcoreagent-linux.sh -Destination "/opt/apminsight/dotnet" -LicenseKey "your_license_key" && \ rm apminsight-dotnetcoreagent-linux.sh # set the env variables for the APM Insight Agent ENV SITE24X7_APP_NAME=your_monitor_name ENV S247_LICENSE_KEY=your_license_key ENV CORECLR_ENABLE_PROFILING=1 ENV PAL_OUTPUTDEBUGSTRING=1 ENV CORECLR_PROFILER="{9d363a5f-ed5f-4aac-b456-75affa6aa0c8}" ENV CORECLR_SITE24X7_HOME="/opt/apminsight/dotnet/ApmInsightDotNetCoreAgent" ENV CORECLR_PROFILER_PATH_64="/opt/apminsight/dotnet/ApmInsightDotNetCoreAgent/x64/libClrProfilerAgent.so" ENV CORECLR_PROFILER_PATH_32="/opt/apminsight/dotnet/ApmInsightDotNetCoreAgent/x86/libClrProfilerAgent.so" ENV DOTNET_STARTUP_HOOKS="/opt/apminsight/dotnet/ApmInsightDotNetCoreAgent/netstandard2.0/DotNetAgent.Loader.dll" ENV MANAGEENGINE_COMMUNICATION_MODE="direct" # Expose the required for your app port (adjust if needed) EXPOSE 80 # Set entrypoint ENTRYPOINT ["dotnet", "your_app.dll"] # replace with your actual app DLL
- Replace your_license_key with your actual Site24x7 APM Insight license key.
- Replace your_monitor_name with your application name.
Related articles
How to install various APM Insight agents in a Docker container
Java | PHP | Node.js | Python
How to install various APM Insight agents in a Kubernetes environment
Java | .NET | PHP | Node.js | Python