can't find a suitable configuration file in this directory or any docker compose (docker-compose section not getting added in solution)

19,206

Not really an expert on VS 2017, but you would need to create a docker-compose.yml file inside of the project.

More information can be found 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

Edit: In order for VS 2017 to automatically create docker-compose.yml, you will need to right-click on the Project and select Add > Orchestrator Support (15.8 and greater) or Add > Docker Project Support (below 15.8).

Share:
19,206
Ranadheer Reddy
Author by

Ranadheer Reddy

Currently am working as a software developer in Hyderabad, India. I love to learn new technologies. I like blogging too. And my Rule: Enjoy the life. It comes only Once :-)

Updated on July 25, 2022

Comments

  • Ranadheer Reddy
    Ranadheer Reddy almost 2 years

    I've installed docker on my windows (10), and when I try to build a new project, I always get the following error:

    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
    

    When i check the project i created in visual studio 2017, i don't see docker-compose section in solution. It just has one project (.Net core 2.0) and one Dockerfile file in it.

    Following are the steps i followed.

    File-> new Project -> Asp.Net core web application -> API (Enable Docker Support) -> OK

    enter image description here

    and this is how my project structure looks like (no docker-compose section in it)

    enter image description here

    Am i missing anything here ?

  • Ranadheer Reddy
    Ranadheer Reddy over 5 years
    do i have to create it manually for every solution that u create ? As i selected Docker Support while creating project, it is supposed to add that file
  • Anthony Bennett
    Anthony Bennett over 5 years
    It looks like you can right-click your application and choose Add > Docker Project Support to generate the files for you.
  • Ranadheer Reddy
    Ranadheer Reddy over 5 years
    Hi Anthony. Thanks for the reply. I even tried that but it just re-created Dockerfile but did not add docker-compose (yaml/yml) file
  • Anthony Bennett
    Anthony Bennett over 5 years
    What version of VS 2017 do you have? For 15.8 or greater, you would need to do Add > Container Orchestrator Suppport
  • Ranadheer Reddy
    Ranadheer Reddy over 5 years
    OMG.. You are life savior..... my VS version is 15.8.3. and selecting the Container Orchestrator Support worked for me.. It created docker-compose section with yml files...... Thank u very much Anthony... Please update your answer so that i will mark it as correct answer.. Cheers !!! :) :)
  • Anthony Bennett
    Anthony Bennett over 5 years
    Edited answer :)
  • Ranadheer Reddy
    Ranadheer Reddy over 5 years
    Thank you. Accepted your answer. :)