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

标签 docker asp.net-core docker-compose dockerfile asp.net-core-2.0

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

enter image description here

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

enter image description here

我这里有什么遗漏吗?

最佳答案

不是真正的 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/

相关文章:

node.js - VS Code 没有为在 Docker 容器中运行的 Node 应用程序命中断点

c# - ASP.NET Web-api 核心 : Handling client connections problems and find conflicts

reactjs - 无法执行从一个 docker 镜像到另一个 docker 镜像的API请求

wordpress - 在 Docker 容器之间可以 ping 但不能 wget

Azure 在开始日志中添加时间戳

python - 在Shinyproxy中为Dash应用交付静态 Assets 时出错

linux - Docker:安装/共享单个 sock 文件?

c# - 无法创建 asp net core 2.0 web api

visual-studio-2015 - 使用 vstest 运行 xUnit 测试

Docker compose 在 mac 上抛出权限被拒绝的问题