Windows Docker容器不断重新启动

mzmfm0qo  于 2023-02-11  发布在  Docker
关注(0)|答案(1)|浏览(222)

我使用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中看到的内容:

日志中没有错误。我不知道它可能有什么问题。

rqqzpn5f

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

相关问题