简体   繁体   中英

docker-compose Can't find a suitable configuration file

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM