英文:
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:
英文:
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:
答案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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论