gpt4 book ai didi

powershell - 容器尝试Powershell时在CreateProcess期间遇到错误

转载 作者:行者123 更新时间:2023-12-02 18:36:07 29 4
gpt4 key购买 nike

我设法在Windows 10计算机上的容器中设置了一个asp.net core(2.2)应用程序,并且可以在浏览器中浏览该应用程序。但是,我无法按以下说明对容器进行powershell:Running powershell or cmd on docker container

docker exec -it 723b19acf1d6 powershell

我进入Powershell时出错:
container 723b19acf1d6a796812832dff82c2240af465d9100ade64d9ff95afce1a4267b encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2)
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(174)\vmcomputeagent.exe!00007FF7E0C2C00A: (caller: 00007FF7E0BFECEA) Exception(9) tid(580) 80070002 The system cannot find the file specified.
CallContext:[\Bridge_ProcessMessage\ComputeSystemManager_ExecuteProcess\VmHostedContainer_ExecuteProcess]
Provider: 00000000-0000-0000-0000-000000000000] extra info: {"CommandLine":"powershell","User":"ContainerUser","WorkingDirectory":"C:\\app","Environment":{"ASPNETCORE_URLS":"http://+:80","DOTNET_RUNNING_IN_CONTAINER":"true"},"EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[0,0]}

enter image description here

我用来设置容器的运行命令:

docker run -p 8081:443 -p 8080:80 -h myweb -v D:\Learn\DockerTrials\APITest\APITest:c:\temp apitest

Dockerfile:
#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https://aka.ms/containercompat

FROM microsoft/dotnet:2.2-aspnetcore-runtime-nanoserver-1803 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

COPY certificate.ps1 .

FROM microsoft/dotnet:2.2-sdk-nanoserver-1803 AS build
WORKDIR /src
COPY ["APITest.csproj", "APITest/"]
RUN dotnet restore "APITest/APITest.csproj"
COPY . ./

RUN dotnet build "APITest.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "APITest.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "APITest.dll"]

我正在尝试通过按照以下说明运行powershell文件来设置https: https://blogs.msdn.microsoft.com/zxue/2016/12/19/adding-https-support-to-individual-windows-containers-using-self-issued-certificates/

最佳答案

From Microsoft community forum:

Microsoft removed powershell and other pieces from base nanoserver image. You need to use image with built in powershell.

关于powershell - 容器尝试Powershell时在CreateProcess期间遇到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56101825/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com