Docker Compose Up fails with; Skipping project "ProjectName" because it was not found. But the dockerfile works with visual studio docker compose

huangapple go评论55阅读模式
英文:

Docker Compose Up fails with; Skipping project "ProjectName" because it was not found. But the dockerfile works with visual studio docker compose

问题

I have set up docker compose with visual studio and it works, spinning up containers and everything. But when I attempt to use

docker compose up

When it comes to the following in the dockerfile

RUN dotnet restore "DockerTestApi/DockerTestApi.csproj"

it fails, with several similar to the following

Skipping project "/src/ExternalDataProvider/ExternalDataProvider.csproj" because it was not found.

I guess it has to do with directories or something, but it is weird it works through visual studio. One in my team uses vscode and needs to be able to start docker compose through that.

Pictures:

terminal view

Directory Hierarchy

Dockerfile

英文:

I have set up docker compose with visual studio and it works, spinning up containers and everything. But when I attempt to use

docker compose up

When it comes to the following in the dockerfile

RUN dotnet restore "DockerTestApi/DockerTestApi.csproj"

it fails, with several similar to the following

Skipping project "/src/ExternalDataProvider/ExternalDataProvider.csproj" because it was not found.

I guess it has to do with directories or something, but it is wierd it works through visual studio. One in my team uses vscode and needs to be able to start docker compose through that.

Pictures:

terminal view

Directory Hierarchy

Dockerfile

答案1

得分: 0

了解。以下是翻译的内容:

当在VS中运行时,它会执行一系列优化,可以绕过你所看到的恢复错误类型。

根据你的Dockerfile和错误,我怀疑项目结构可能已经在生成Dockerfile之后发生了变化。
两个推荐的修复方法:
你可以通过右键单击项目,然后选择添加 -> Docker 支持... 来重新生成文件。
-- 或者 --
你可以删除第7和第8行(项目特定的COPY和恢复)。这是一个很好但不是必需的构建优化。

英文:

FYI When running from VS it does a bunch of optimizations that can by-pass the type of restore errors you're seeing.

Looking at your Dockerfile and errors, I suspect that changes have been made to the project structure since the Dockerfile was scaffolded.
Two recommended fixes:
You can regenerate the file by right-clicking on the project and selecting Add -> Docker Support...
-- OR --
You can delete lines 7 & 8 (the project specific COPY and restore). That's a build optimization that's nice but not needed.

huangapple
  • 本文由 发表于 2023年4月13日 20:10:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76005264.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定