我在我的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核心Web应用程序 - > 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
,您需要右键单击Project并选择Add> Orchestrator Support(15.8及更高版本)或Add> Docker Project Support(15.8以下)。