web-dev-qa-db-ja.com

このディレクトリまたはdockercomposeで適切な構成ファイルが見つかりません(docker-composeセクションがソリューションに追加されていません)

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 ソリューションのセクション。 1つのプロジェクト(.Net core 2.0)と1つのDockerfileファイルが含まれています。

以下は私が従ったステップです。

ファイル->新しいプロジェクト-> Asp.NetコアWebアプリケーション-> API(Dockerサポートを有効にする)-> OK

enter image description here

これが私のプロジェクト構造の様子です(docker-composeセクションはありません)

enter image description here

私はここで何かが欠けていますか?

6
Ranadheer Reddy

VS 2017の専門家ではありませんが、プロジェクト内にdocker-compose.ymlファイルを作成する必要があります。

詳細については、 ここ を参照してください。

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

編集:VS2017でdocker-compose.ymlを自動的に作成するには、プロジェクトを右クリックして、[追加]> [Orchestratorサポート]を選択する必要があります。 (15.8以降)または[追加]> [Dockerプロジェクトサポート](15.8未満)。

7
Anthony Bennett