docker-compose Can't find a suitable configuration file

Viewed 9997

For anyone that knows about docker on Linux:

I just try to docker-compose a simple docker image, getting this weird error telling me that there is no docker-compose.yml file - however the file actually exists. See this asciinema demonstration:

https://asciinema.org/a/rudbq7AKTJBQlGj8LVJHIG7Zx

2 Answers

Moving my docker-compose.yml files into (children of) /root solved the issue for me.

Doing a docker-compose up in /srv/mystuff resulted in a Can't find a suitable configuration file... error, although /srv/mystuff/docker-compose.yml existed. Then I did

mv /srv/mystuff /root
cd /root/mystuff
docker-compose up

It worked. Because apparently:

All files that docker needs access to should live within your $HOME folder.

https://github.com/docker/compose/issues/6361#issuecomment-588301001

https://github.com/docker-archive/docker-snap#usage

You did not have include docker-compose version in composer file. Try to define your services properly as follows.

version: '3'
services:
  my-test:
   image: hello-world

Usefull link

Related