docker-compose up giving file not found error
Asked Answered
E

2

7

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

Embolden answered 10/1, 2020 at 6:3 Comment(7)
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.Coaptation
@Coaptation how to i found that if docker-compose pointing to correct directory or not ?Embolden
You could for example pwd and ls before you launch to make sure you are in the correct dir.Coaptation
@Coaptation its giving home/user. how to point to directory which contains .yml fileEmbolden
by changing directory to where your docker-compose.yml file is or by passing its path to docker-compose with the -f optionCoaptation
@Coaptation 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'Embolden
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 thatMariettamariette
P
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
Paderna answered 28/8, 2021 at 18:59 Comment(2)
"/usr/bin/systemctl": Cannot execute binary file is the error message I get while trying to run this inside the containerArgus
Well, if you're running this command inside a container, than the service is up, so probably is something else.Paderna
P
-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 .

Poi answered 10/1, 2020 at 9:11 Comment(3)
i meant go to the directory where are u have created ur yml file . @RituChoudhariPoi
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'Embolden
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 @RituChoudhariPoi

© 2022 - 2024 — McMap. All rights reserved.