我使用sdk:4.8-windowsservercore-ltsc2019
映像构建了一个映像,当我使用该映像运行容器时,它不断地重新启动。有人能帮我解决这个问题吗?我的容器主机是Windows Server 2019。
这是我的文档
# escape=`
FROM dotnet/framework/sdk:4.8-windowsservercore-ltsc2019
USER ContainerAdministrator
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
### Set TLS to 1.2
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
### Chocolatey installation
ENV chocolateyUseWindowsCompression=false
RUN Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
ENV chocolateyUseWindowsCompression=false
RUN choco config set cachelocation C:\chococache
RUN choco feature enable --name allowGlobalConfirmation
### VS Build Tools 2017
RUN choco install microsoft-build-tools
RUN choco install visualstudio2017-workload-webbuildtools
### Microsoft .NET Framework 4.6.2 Developer Pack
RUN choco install netfx-4.6.2-devpack --confirm --limit-output
### .Net Core SDK 1.0.1
RUN choco install dotnetcoresdk
### .NET Core SDK 1.1.14
RUN choco install dotnetcore-sdk --version=1.1.14
### .NET Core SDK 2.2.402
RUN choco install dotnetcore-sdk --version=2.2.402
### MVC 4
RUN choco install aspnetmvc --confirm --limit-output
### MVC 3
RUN choco install aspnetmvc --version 3.0.0.2 --confirm --limit-output
### Gitversion
RUN choco install gitversion.portable
### Node JS 9.4.0
RUN choco install nodejs --version=9.4.0
### Install grunt
RUN npm -g install grunt-cli
RUN Remove-Item -Path 'C:/Program Files/Dotnet/SDK/6.*' -Force -Recurse
USER ContainerUser
### Define the entry point for the docker container.
SHELL ["cmd", "/S", "/C"]
下面是我的docker build
命令:
docker build -t net.buildagent:v1 .
这里是我的docker run
命令:
docker run --name buildagent -d --restart=unless-stopped net.buildagent:v1
下面是我在docker logs
中看到的内容:
日志中没有错误。我不知道它可能有什么问题。
1条答案
按热度按时间rqqzpn5f1#
默认情况下,你不会通过
docker logs
看到来自Windows容器的日志。你必须使用日志监视器才能从容器中获取Widnows日志,因为Windows不会将日志发送到stdout,而stdout是docker logs
检查的内容。https://techcommunity.microsoft.com/t5/itops-talk-blog/how-to-troubleshoot-applications-on-windows-containers-with-the/ba-p/3201318?WT.mc_id=modinfra-56286-viniap