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.
Note:
[YOUR_LICENSE_KEY] with your actual APM Insight license key from Applications Manager.[YOUR_APP_NAME] with your application name.Below is an example of configuring the .NET agent on a Windows Docker container.
FROM mcr.microsoft.com/dotnet/framework/aspnet EXPOSE 80# Publish your applicationCOPY [YOUR_APP_TO_BE_PUBLISHED] /inetpub/wwwroot# Download the APM Insight .NET agent installerRUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;\ Invoke-WebRequest "https://www.manageengine.com/products/applications_manager/54974026/apminsight-dotnetagent.msi" -UseBasicParsing -OutFile "apminsight-dotnetagent.msi"# Install the APM Insight .NET agentRUN Start-Process -Wait -FilePath msiexec -ArgumentList /i, "apminsight-dotnetagent.msi", /qn, editconfig=false, useappfilters=false, license.key=[YOUR_LICENSE_KEY], apm.host=[APM_HOST], apm.port=[APM_PORT]# Remove the APM Insight .NET agent installerRUN Remove-Item "apminsight-dotnetagent.msi"# Set your application nameENV APMINSIGHT_APP_NAME=[YOUR_APP_NAME]Below is an example of configuring the .NET agent on a Linux Docker container.
# Use Linux-based ASP.NET runtime imageFROM mcr.microsoft.com/dotnet/aspnet:6.0# Set working directoryWORKDIR /app# Copy your published appCOPY [YOUR_APP_TO_BE_PUBLISHED_FOLDER]/ . # replace with your actual published app folder path# Download and install APM Insight Data Exporter & .NET Core AgentRUN apt-get update && \ apt-get install -y wget ca-certificates unzip procps && \ wget -O InstallDataExporter.zip "https://www.manageengine.com/products/applications_manager/54974026/InstallDataExporter.zip" && \ unzip InstallDataExporter.zip && \ sh InstallDataExporter.sh -root -nsvc -lk "[YOUR_LICENSE_KEY]" -apm.host "https://[APM_HOST]:[APM_PORT]" && \ wget -O InstallNetCoreAgent.zip "https://www.manageengine.com/products/applications_manager/54974026/InstallNetCoreAgent.zip" && \ unzip InstallNetCoreAgent.zip && \ chmod +x InstallNetCoreAgent.sh && \ ./InstallNetCoreAgent.sh -LicenseKey "[YOUR_LICENSE_KEY]" -ExporterHost localhost -ExporterStatusPort 20021 -ExporterDataPort 20022 && \ rm -f InstallDataExporter.zip InstallNetCoreAgent.zip# Set the environment variables for the APM Insight AgentENV APMINSIGHT_LICENSEKEY="[YOUR_LICENSE_KEY]"ENV APMINSIGHT_APP_NAME="[YOUR_APP_NAME]"ENV CORECLR_ENABLE_PROFILING=1ENV CORECLR_PROFILER="{9D363A5F-ED5F-4AAC-B456-75AFFA6AA0C8}"ENV DOTNETCOREAGENT_HOME="/opt/manageengine/ManageEngineDotNetCoreAgent"ENV CORECLR_PROFILER_PATH_64="/opt/manageengine/ManageEngineDotNetCoreAgent/x64/libClrProfilerAgent.so"ENV CORECLR_PROFILER_PATH_32="/opt/manageengine/ManageEngineDotNetCoreAgent/x86/libClrProfilerAgent.so"ENV DOTNET_STARTUP_HOOKS="/opt/manageengine/ManageEngineDotNetCoreAgent/netstandard2.0/DotNetAgent.Loader.dll"ENV MANAGEENGINE_COMMUNICATION_MODE="ExporterService"# Expose the required port for your app (adjust if needed)EXPOSE 80# Start Data Exporter in background and then run your appENTRYPOINT ["/bin/sh", "-c", "/opt/AppManagerDataExporter/bin/AppManagerDataExporter & dotnet [YOUR_APPLICATION].dll"]Below is an example of configuring the .NET Core agent on a Windows Docker container.
FROM mcr.microsoft.com/windows/servercore:ltsc2019# Publish your applicationCOPY [YOUR_APP_TO_BE_PUBLISHED]#Install .NET core frameworkRUN powershell.exe [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;\ Invoke-WebRequest "https://download.visualstudio.microsoft.com/download/pr/a0832b5a-6900-442b-af79-6ffddddd6ba4/e2df0b25dd851ee0b38a86947dd0e42e/dotnet-runtime-5.0.17-win-x64.exe" -UseBasicParsing- OutFile "dotnet-runtime-5.0.17-win-x64.exe" RUN dotnet-runtime-5.0.17-win-x64.exe /quiet /installRUN powershell.exe [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;\Invoke-WebRequest "https://download.visualstudio.microsoft.com/download/pr/3789ec90-2717-424f-8b9c-3adbbcea6c16/2085cc5ff077b8789ff938015392e406/aspnetcore-runtime-5.0.17-win-x64.exe" -UseBasicParsing-OutFile "aspnetcore-runtime-5.0.17-win-x64.exe"# Extract APM Insight .NET core agent zipRUN powershell.exe Expand-Archive -LiteralPath 'apminsight-dotnetcoreagent.zip' -DestinationPath apminsight-dotnetcoreagent# Install the APM Insight .NET core agentRUN powershell.exe ".\apminsight-dotnetcoreagent\dotnet_core\InstallAgent.ps1" -Destination ".\appmanager" -InstallType global -LicenseKey [YOUR_LICENSE_KEY] # Remove the APM Insight .NET agent installer zipRUN powershell.exe Remove-Item "apminsight-dotnetcoreagent.zip"# Remove the APM Insight .NET agent installerRUN powershell.exe Remove-Item "apminsight-dotnetcoreagent" -Recurse -Force #RUN setx path "%path%;.\Program Files\dotnet\"RUN setx path "%path%;C:\Program Files (x86)\dotnet\"WORKDIR /app #ENTRYPOINT ["powershell.exe",".\\Program Files\\dotnet\\dotnet.exe", ".\\ASPNETWebApp.dll"]ENTRYPOINT ["powershell.exe"]CMD ["dotnet", "\\ASPNET5WebApp.dll", "--urls", "http://*:5000"]After Docker start,
It allows us to track crucial metrics such as response times, resource utilization, error rates, and transaction performance. The real-time monitoring alerts promptly notify us of any issues or anomalies, enabling us to take immediate action.
Reviewer Role: Research and Development