gpt4 book ai didi

c# - 命令 '/bin/sh -c dotnet restore ./DockerTestDebian.csproj' 返回非零代码 : 1

转载 作者:行者123 更新时间:2023-11-30 22:56:46 24 4
gpt4 key购买 nike

我创建了一个在 debian 9 上构建的 dockerfile,它应该使用我的 vscode 项目文件夹构建一个 docker 镜像,但是当我构建我的 docker 镜像时我得到了 2 个模糊的错误。我所有的文件都在 home/rydeb/Desktop/DockerTestDebian 目录下

尝试构建我的图像的结果

 Step 1/12 : FROM microsoft/dotnet:2.0-sdk as builder
---> 9e06837225a4
Step 2/12 : ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
---> Using cache
---> a7abd475d0e7
Step 3/12 : RUN mkdir -p /home/rydeb/Desktop/DockerBuildStuff
---> Using cache
---> 72a293c67243
Step 4/12 : WORKDIR /home/rydeb/Desktop/DockerTestDebian
---> Running in 197210d0dc93
Removing intermediate container 197210d0dc93
---> 8b696a6350b1
Step 5/12 : COPY . /DockerBuildStuff
---> d38caf512a12
Step 6/12 : WORKDIR /home/rydeb/Desktop/DockerBuildStuff/DockerTestDebian
---> Running in ba9d0a67d8f4
Removing intermediate container ba9d0a67d8f4
---> b35c16802b52
Step 7/12 : RUN dotnet restore ./DockerTestDebian.csproj
---> Running in 7d5dfb98591d
MSBUILD : error MSB1009: Project file does not exist.
Switch: ./DockerTestDebian.csproj
The command '/bin/sh -c dotnet restore ./DockerTestDebian.csproj' returned a non-zero code: 1

我的 docker 文件

FROM microsoft/dotnet:2.0-sdk as builder  
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1

RUN mkdir -p /home/rydeb/Desktop/DockerBuildStuff
WORKDIR /home/rydeb/Desktop/DockerTestDebian
COPY . /DockerBuildStuff
WORKDIR /home/rydeb/Desktop/DockerBuildStuff/DockerTestDebian

RUN dotnet restore ./DockerTestDebian.csproj
RUN dotnet publish -c release -o published -r linux-arm

FROM microsoft/dotnet:2.0.0-runtime-stretch-arm32v7

WORKDIR /root/
COPY --from=builder /root/src/app/DockerTestDebian/published .

CMD ["dotnet", "./DockerTestDebian.dll"]

最佳答案

我刚刚设法让它基于此处的 Docker 文件运行:

https://github.com/dotnet/dotnet-docker/blob/master/samples/aspnetapp/Dockerfile

我只是注释掉了

RUN dotnet restore

这样做允许它继续并在

RUN dotnet publish

似乎对我来说工作正常。

关于c# - 命令 '/bin/sh -c dotnet restore ./DockerTestDebian.csproj' 返回非零代码 : 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54153915/

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