我已经在我的 windows (10) 上安装了 docker,当我尝试构建一个新项目时,我总是收到以下错误:
Can't find a suitable configuration file in this directory or any
parent. Are you in the right directory?
Supported filenames: docker-compose.yml, docker-compose.yaml
当我检查我在 Visual Studio 2017 中创建的项目时,我没有在解决方案中看到 docker-compose 部分。它只有一个项目(.Net core 2.0)和一个 Dockerfile 文件。
以下是我遵循的步骤。
文件->新建项目->Asp.Net核心网络应用->API(启用Docker支持)->确定
这就是我的项目结构的样子(其中没有 docker-compose 部分)
我这里有什么遗漏吗?
最佳答案
不是真正的 VS 2017 专家,但您需要在项目内创建一个 docker-compose.yml
文件。
更多信息可以找到here .
version: '3.5'
services:
client:
container_name: WebApplication
build:
dockerfile: Dockerfile
volumes:
# Any volumes you would mount goes here
ports:
# Ports that need to be mapped from container to host goes here
environment:
# Any environment variables
编辑:为了让 VS 2017 自动创建 docker-compose.yml
,您需要右键单击项目并选择添加 > Orchestrator Support ( 15.8 及更高版本)或添加 > Docker 项目支持(低于 15.8)。
关于docker - 在此目录或任何 docker compose 中找不到合适的配置文件(解决方案中未添加 docker-compose 部分),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52224625/