【问题标题】:Docker Container Instance fails to start in AzureDocker 容器实例无法在 Azure 中启动
【发布时间】:2020-04-07 09:37:18
【问题描述】:

我有一个 .Net 4.7.2 应用程序,我试图在 Azure 的容器实例中运行它。在本地构建和启动时,它工作得很好。但是,在部署时,它无法启动。我没有日志(至少,没有我知道存在的任何日志)。这是我的 docker 文件:

 # escape=`

ARG REPO=mcr.microsoft.com/dotnet/framework/runtime
FROM $REPO:4.7.2-windowsservercore-ltsc2019

# Install .NET 4.7.2
RUN powershell -Command `
        $ProgressPreference = 'SilentlyContinue'; `
        Invoke-WebRequest `
            -UseBasicParsing `
            -Uri "https://download.microsoft.com/download/6/E/4/6E48E8AB-DC00-419E-9704-06DD46E5F81D/NDP472-KB4054530-x86-x64-AllOS-ENU.exe" `
            -OutFile dotnet-framework-installer.exe `
    && start /w .\dotnet-framework-installer.exe /q `
    && del .\dotnet-framework-installer.exe `
    && powershell Remove-Item -Force -Recurse ${Env:TEMP}\*

# Restore the default Windows shell for correct batch processing.
SHELL ["cmd", "/S", "/C"]

# Download the Build Tools bootstrapper.
ADD https://aka.ms/vs/16/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe

# Install Build Tools with the Microsoft.VisualStudio.Workload.AzureBuildTools workload, excluding workloads and components with known issues.
RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
    --installPath C:\BuildTools `
    --add Microsoft.VisualStudio.Workload.AzureBuildTools `
    --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 `
    --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 `
    --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 `
    --remove Microsoft.VisualStudio.Component.Windows81SDK `
 || IF "%ERRORLEVEL%"=="3010" EXIT 0

# Copy everything and build app
COPY . C:\Build
RUN "C:/BuildTools/MSBuild/Current/Bin/MSBuild.exe C:/Build/src/App.sln"

ENTRYPOINT cd C:/Build/build/bin/ && App.exe -m 1234 -v ./Files -s config.txt -n 10 -l 0 -t 4

我被难住了。我什至不知道从哪里开始,因为没有日志。任何帮助都会很棒。

谢谢,

【问题讨论】:

  • 你得到什么错误?
  • @CharlesXu 我没有收到错误:/ 这就是问题
  • 还有问题吗?它解决了你的问题吗?如果它对你有用,请接受它。我没有看到任何更新。你还在处理这个问题吗?

标签: azure docker azure-container-instances


【解决方案1】:

我确定如果你改变容器的内部目录,你可以成功。

C:\TEMP\vs_buildtools.exe to C:\vs_buildtools.exe

【讨论】:

  • 感谢您的回复。构建没有问题,但是问题在于启动 exe。当我将二进制文件放入容器时,我得到了相同的结果。
【解决方案2】:

从您所说的错误来看,您似乎在 Windows 操作系统中使用了错误的字符。 Windows 操作系统与 Linux 不同。在 Windows 中,您需要使用 \ 作为路径。查看 Dockerfile 中的 example 以获得 Windows 路径。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-28
    相关资源
    最近更新 更多