Help Docs

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 Core agent on a Windows Docker container

Below you'll find an example of configuring the .NET Core agent on a Windows Docker container.

FROM mcr.microsoft.com/windows/servercore:ltsc2019

# Publish your application
COPY your app to be published /app

# Download the APM Insight .NET core agent zip
RUN powershell.exe [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;\
Invoke-WebRequest "https://staticdownloads.site24x7.com/apminsight/agents/apminsight-dotnetcoreagent.zip" -UseBasicParsing -OutFile "apminsight-dotnetcoreagent.zip"

# Extract APM Insight .NET core agent zip
RUN powershell.exe Expand-Archive -LiteralPath 'apminsight-dotnetcoreagent.zip' -DestinationPath apminsight-dotnetcoreagent

# Install the APM Insight .NET core agent
RUN powershell.exe ".\apminsight-dotnetcoreagent\dotnet_core\InstallAgent.ps1" -Destination ".\site24x7" -InstallType global -LicenseKey YOUR_LICENSE_KEY

# Remove the APM Insight .NET agent installer zip
RUN powershell.exe Remove-Item "apminsight-dotnetcoreagent.zip"

# Remove the APM Insight .NET agent installer
RUN powershell.exe Remove-Item "apminsight-dotnetcoreagent" -Recurse -Force

# Set your application name
ENV SITE24X7_APP_NAME=YOUR_APP_NAME

# Windows or Servercore images may not include .NET Core SDK or runtime
RUN dotnet sdk/runtime installer

WORKDIR /app

ENTRYPOINT ["dotnet", ".\\YOUR_APP_NAME.dll"]

Install the .NET Core agent on a Linux Docker container

Get information on configuring the .NET Core agent on a Linux Docker container.

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

Was this document helpful?

Would you like to help us improve our documents? Tell us what you think we could do better.


We're sorry to hear that you're not satisfied with the document. We'd love to learn what we could do to improve the experience.


Thanks for taking the time to share your feedback. We'll use your feedback to improve our online help resources.

Shortlink has been copied!