在 Docker 容器上安装 APM Insight .NET 代理
在 Docker 容器中安装 .NET 代理与在 Windows 中安装标准 .NET 代理相同。您需要配置DockerFile来执行安装。
内容:
- 在 Windows Docker 容器上安装 .NET 代理
- 在 Windows Docker 容器上安装 .NET Core 代理
- 在 Linux Docker 容器上安装 .NET Core 代理
在 Windows Docker 容器上安装 .NET 代理
下面是在 Windows Docker 容器上配置 .NET 代理的示例。
FROM mcr.microsoft.com/dotnet/framework/aspnet
# 发布您的应用程序
COPY 您要发布的应用程序 /inetpub/wwwroot
# 下载 APM Insight .NET 代理安装程序
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType] ::Tls12;\
Invoke-WebRequest "https://staticdownloads.site24x7.com/apminsight/agents/apminsight-dotnetagent.msi" -UseBasicParsing -OutFile "apminsight-dotnetagent.msi"
# 安装 APM Insight .NET 代理
RUN 开始-Process -Wait -FilePath msiexec -ArgumentList /i, "apminsight-dotnetagent.msi", /qn, editconfig=false, useappfilters=false, license.key=YOUR_LICENSE_KEY
# 删除 APM Insight .NET 代理安装程序
RUN Remove-Item " apminsight-dotnetagent.msi"
# 设置你的应用名称
ENV SITE24X7_APP_NAME=YOUR_APP_NAME
# 发布您的应用程序
COPY 您要发布的应用程序 /inetpub/wwwroot
# 下载 APM Insight .NET 代理安装程序
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType] ::Tls12;\
Invoke-WebRequest "https://staticdownloads.site24x7.com/apminsight/agents/apminsight-dotnetagent.msi" -UseBasicParsing -OutFile "apminsight-dotnetagent.msi"
# 安装 APM Insight .NET 代理
RUN 开始-Process -Wait -FilePath msiexec -ArgumentList /i, "apminsight-dotnetagent.msi", /qn, editconfig=false, useappfilters=false, license.key=YOUR_LICENSE_KEY
# 删除 APM Insight .NET 代理安装程序
RUN Remove-Item " apminsight-dotnetagent.msi"
# 设置你的应用名称
ENV SITE24X7_APP_NAME=YOUR_APP_NAME
在 Windows Docker 容器上安装 .NET Core 代理
下面是在 Windows Docker 容器上配置 .NET Core 代理的示例。
FROM mcr.microsoft.com/windows/servercore:ltsc2019
# Publish your application
COPY your app to be publishing /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"
# 提取 APM Insight .NET 核心代理zip
RUN powershell.exe Expand-Archive -LiteralPath 'apminsight-dotnetcoreagent.zip' -DestinationPath apminsight-dotnetcoreagent
# 安装 APM Insight .NET 核心代理
RUN powershell.exe ".\apminsight-dotnetcoreagent\dotnet_core\InstallAgent.ps1" -Destination ".\site24x7" -InstallType global -LicenseKey YOUR_LICENSE_KEY
# 删除 APM Insight .NET 代理安装程序 zip
RUN powershell.exe Remove-Item "apminsight- dotnetcoreagent.zip"
# 删除 APM Insight .NET 代理安装程序
RUN powershell.exe Remove-Item "apminsight-dotnetcoreagent" -Recurse -Force
# 设置您的应用程序名称
ENV SITE24X7_APP_NAME=YOUR_APP_NAME
# Windows 或 Servercore 映像可能不包含 .NET Core SDK或运行时
RUN dotnet sdk/runtime installer
WORKDIR /app
ENTRYPOINT ["dotnet", ".\\YOUR_APP_NAME.dll"]
# Publish your application
COPY your app to be publishing /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"
# 提取 APM Insight .NET 核心代理zip
RUN powershell.exe Expand-Archive -LiteralPath 'apminsight-dotnetcoreagent.zip' -DestinationPath apminsight-dotnetcoreagent
# 安装 APM Insight .NET 核心代理
RUN powershell.exe ".\apminsight-dotnetcoreagent\dotnet_core\InstallAgent.ps1" -Destination ".\site24x7" -InstallType global -LicenseKey YOUR_LICENSE_KEY
# 删除 APM Insight .NET 代理安装程序 zip
RUN powershell.exe Remove-Item "apminsight- dotnetcoreagent.zip"
# 删除 APM Insight .NET 代理安装程序
RUN powershell.exe Remove-Item "apminsight-dotnetcoreagent" -Recurse -Force
# 设置您的应用程序名称
ENV SITE24X7_APP_NAME=YOUR_APP_NAME
# Windows 或 Servercore 映像可能不包含 .NET Core SDK或运行时
RUN dotnet sdk/runtime installer
WORKDIR /app
ENTRYPOINT ["dotnet", ".\\YOUR_APP_NAME.dll"]
在 Linux Docker 容器上安装 .NET Core 代理
获取有关在Linux Docker 容器上配置 .NET Core 代理的信息。