Compose: "Can't find a suitable configuration file" on Ubuntu 18.04.1

Created on 22 Nov 2018  路  19Comments  路  Source: docker/compose

I am running a fresh Ubuntu 18.04:

$ cat /etc/issue
Ubuntu 18.04.1 LTS \n \l

I added the APT apt-repositries as described here. I have docker 18.09.0 and docker-compose 1.22.0:

root@srv:/docker# docker version
Client:
 Version:           18.09.0
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        4d60db4
 Built:             Wed Nov  7 00:49:01 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.0
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       4d60db4
  Built:            Wed Nov  7 00:16:44 2018
  OS/Arch:          linux/amd64
  Experimental:     false
root@srv:/docker# docker-compose version
docker-compose version 1.22.0, build unknown
docker-py version: 3.5.0
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
root@srv:/docker#

I want to use docker-compose in a folder called /docker:

root@srv:/docker# ls -l
total 4
-rwxr-xr-x 1 administrator docker 458 Nov 22 13:44 docker-compose.yml

If I hit docker-compose up, I get the following error:

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

Any idea? How can I debug that issue?

Most helpful comment

I ran into the same problem with a fresh Ubuntu 18.04 install, where I selected Docker from install options.

I had the exactly same issue. After some digging I found out that the docker-compose was installed as a "snap" package. Applications from snap packages are running in a sandbox and they do not see the /tmp directory where I happened to have my docker-compose.yml file. Solution:

sudo snap remove docker
sudo apt install docker.io docker-compose

All 19 comments

My workaround:

I assume, docker-compose was installed automatically, when I installed the docker-ce package. Since I wasn't able to stop containers, I disabled Appmour. It seems, that this removed docker-compose as well. Thus, I installed docker-compose manually. Now, docker-compose works for me.

The original issue was probably a permissions problem, but I'm glad you could solve it regardless.

I ran into the same problem with a fresh Ubuntu 18.04 install, where I selected Docker from install options.

The permissions was not the problem. But when I followed the "Install Compose" steps on https://docs.docker.com/compose/install/#install-compose it worked right away.

Since I am not the only one, I'll try to create a MWE.

@xy2z I assume, you just overwrote the docker-compose Binary, which was installed by docker.

I ran into the same problem with a fresh Ubuntu 18.04 install, where I selected Docker from install options.

I had the exactly same issue. After some digging I found out that the docker-compose was installed as a "snap" package. Applications from snap packages are running in a sandbox and they do not see the /tmp directory where I happened to have my docker-compose.yml file. Solution:

sudo snap remove docker
sudo apt install docker.io docker-compose

I also had issues with apt's docker-compose

This documentation from docker worked well for me.

Same issue. Any solution to fix it? Thanks

docker-compose version 1.24.1, build 4667896b
docker-py version: 3.7.3
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.1.0j  20 Nov 2018

You need to run your command in the same folder as your doocker-compose.yml file

@prvak's solution worked for me. Muchas gracias!

I ran into the same issue and found an explanation in the docker/docker-snap README:

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

If the docker-compose.yml is outside of the $HOME folder, docker-snap won't see it.

Solution: Move the docker-compose.yml (and accompanying files) inside your $HOME directory.

I ran into the same problem with a fresh Ubuntu 18.04 install, where I selected Docker from install options.

I had the exactly same issue. After some digging I found out that the docker-compose was installed as a "snap" package. Applications from snap packages are running in a sandbox and they do not see the /tmp directory where I happened to have my docker-compose.yml file. Solution:

sudo snap remove docker
sudo apt install docker.io docker-compose

I had the same issue as well (Ubuntu fresh install + selected docker during installation). However, executing the above commands didn't quite fix it, I got this error:

-bash: /snap/bin/docker-compose: No such file or directory

I downloaded the binary (per instructions from the documentation) and had to remove the old snap script:

sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo rm /usr/bin/docker-compose

After that docker-compose works fine, but it seems snap remove didn't clean up very well.

Ran command and get error:

~$ docker-compose ps
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

but --version work correct,
~$ docker-compose --version
docker-compose version 1.25.5, build 8a1c60f6

~$ docker-compose ps

There is no docker-compose.yml in your home directory. Please cd into the directory with that file first.

~$ docker-compose ps

There is no docker-compose.yml in your home directory. Please cd into the directory with that file first.

Same issue on fresh install with Ubuntu Server 20.04.1 LTS. Also selected docker from the recommended packages during install.
docker-compose version 1.25.5, build unknown
Docker version 19.03.11, build dd360c7

ubuntu@main:/auto$ ll
total 48
drwxr-xr-x  6 ubuntu ubuntu 4096 Jul 29 16:54 ./
drwxr-xr-x 21 root   root   4096 Jul 29 16:24 ../
drwxrwxr-x  9 ubuntu ubuntu 4096 Jul 29 16:40 .git/
-rw-rw-r--  1 ubuntu ubuntu   59 Jul 29 16:24 .gitattributes
-rw-rw-r--  1 ubuntu ubuntu    8 Jul 29 16:46 .gitignore
-rw-rw-r--  1 ubuntu ubuntu   83 Jul 29 16:24 .gitmodules
-rw-rw-r--  1 ubuntu ubuntu  819 Jul 29 16:24 README.md
-rw-rw-r--  1 ubuntu ubuntu 6913 Jul 29 16:43 docker-compose.yaml
drwxrwxr-x  2 ubuntu ubuntu 4096 Jul 29 16:24 media/
drwxrwxr-x  2 ubuntu ubuntu 4096 Jul 29 16:40 secrets/
drwxrwxr-x 14 ubuntu ubuntu 4096 Jul 29 16:39 services/
ubuntu@main:/auto$ docker-compose pull
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

ubuntu@main:/auto$ 

yes. the same on on a fresh ubuntu 20.

sudo -i helped me

Installed manually... that works.

Same issue as well on a fresh Ubuntu 20.04. Solved by sudo snap remove docker && sudo apt install docker.io docker-compose as mentioned by prvak.
This difference between the behavior of snap and apt packages is really misleading.

Was this page helpful?
0 / 5 - 0 ratings