Help APM APM Insight using .NET Agent Install .NET Agent on Docker Containers

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.

Contents:

  1. Install the .NET agent on a Windows Docker container
  2. Install the .NET Core agent on a Windows Docker container
  3. Install the .NET Core agent on a Linux Docker container

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.

Was this document helpful?
Thanks for taking the time to share your feedback. We’ll use your feedback to improve our online help resources.

Help APM APM Insight using .NET Agent Install .NET Agent on Docker Containers