无法在此目录中找到合适的配置文件或任何docker撰写(未在解决方案中添加docker-compose部分)

问题描述 投票:6回答:1

我在我的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支持) - >确定

enter image description here

这就是我的项目结构的样子(没有docker-compose部分)

enter image description here

我错过了什么吗?

docker asp.net-core docker-compose dockerfile asp.net-core-2.0
1个回答
7
投票

不是真正的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以下)。

© www.soinside.com 2019 - 2024. All rights reserved.