6

I am using vagrant. when i do git bash in the folder which already contain docker-compose.yml file. but when i execute command docker-compose up then that gives me error like

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

steps i did : 1. went in folder which contain vagrant and docker-compose.yml file 2. right click and clicked on git bash here 3. give command in git bash as vagrant ssh 4. then give command as docker-compose up

Ritu Choudhari
  • 71
  • 1
  • 1
  • 4
  • 1
    You think that `folder [...] already contain docker-compose.yml file`. docker-compose thinks that: `Can't find a suitable configuration file in this directory [...] Supported filenames: docker-compose.yml, docker-compose.yaml`. You need to find why there is such a gap in your respective analyzes of the situation. – Zeitounator Jan 10 '20 at 07:33
  • @Zeitounator how to i found that if docker-compose pointing to correct directory or not ? – Ritu Choudhari Jan 10 '20 at 08:56
  • You could for example `pwd` and `ls` before you launch to make sure you are in the correct dir. – Zeitounator Jan 10 '20 at 10:10
  • @Zeitounator its giving home/user. how to point to directory which contains .yml file – Ritu Choudhari Jan 10 '20 at 10:36
  • by changing directory to where your docker-compose.yml file is or by passing its path to docker-compose with the `-f` option – Zeitounator Jan 10 '20 at 10:44
  • @Zeitounator i tried giving docker-compose with file path and it gives error like - .FileNotFoundError: [Errno 2] No such file or directory: './D:ProjectsGitHubvalde-valde-docker-composedocker-compose.yml' – Ritu Choudhari Jan 10 '20 at 11:00
  • That last error looks like you've swapped "\" for "/". Windows uses a different convention from Linux. Your base machine is Windows, but most Docker images use Linux conventions... although I guess I'm over a year too late to help with that – Sarah Messer Jun 10 '22 at 18:54

2 Answers2

5

It could be that the docker service is down. You can check that with:

sudo systemctl status docker.service

If it's down you can use the following command to restart it.

sudo systemctl restart docker.service
vilma
  • 51
  • 1
  • 3
  • "/usr/bin/systemctl": Cannot execute binary file is the error message I get while trying to run this inside the container – SriniMurthy Oct 05 '21 at 17:14
  • 1
    Well, if you're running this command inside a container, than the service is up, so probably is something else. – vilma Oct 06 '21 at 18:56
-2

point to the directory where ur yml file are . in the yml file u have build line check it . it that line u put the path of ur DockerFile . and apply the command docker-compose up in the path of ur yml file .

  • i meant go to the directory where are u have created ur yml file . @RituChoudhari – khaled hadjali Jan 10 '20 at 10:56
  • i did that only and that file only it is giving file not found.. i tried this also docker-compose -f D:\Projects\GitHub\valde-valde-docker-compose\docker-compose.yml up -d and it gives me error - ERROR: .FileNotFoundError: [Errno 2] No such file or directory: './D:ProjectsGitHubvalde-valde-docker-composedocker-compose.yml' – Ritu Choudhari Jan 10 '20 at 11:02
  • u have an error in ur path , check ur path carefully , and check ur build point in yml file . 1 - first go to that directory : D:\Projects\GitHub\valde-valde-docker-compose\ 2 - open shell here 3 - write in shell : docker-compose up -d @RituChoudhari – khaled hadjali Jan 10 '20 at 11:16