compose: "Can't find a suitable configuration file" on Ubuntu 18.04.1
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?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 15
- Comments: 34
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:You need to run your command in the same folder as your doocker-compose.yml file
I ran into the same issue and found an explanation in the docker/docker-snap README:
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.
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.
The original issue was probably a permissions problem, but I’m glad you could solve it regardless.
There is no
docker-compose.yml
in your home directory. Pleasecd
into the directory with that file first.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.
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
you need save as file docker-compose.yml to docker-compose.yaml
(this is just a recap for people landing here from Google)
Symptoms
When you run
docker-compose up
ordocker-compose build
, you get this message:If you run
docker-compose --version
, you get something like this:Cause
This issue happens with Ubuntu’s default docker installation (when you check the “docker” option during the Ubuntu installation). It happens in Ubuntu 20.04 and 21.04, and possibly in other versions.
Fix
docker-compose
. If you get/snap/bin/docker-compose: No such file or directory
, just start a new shell (or typebash
).docker-compose --version
should now give you the correct version, with the correct build number, and run properly.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:
I downloaded the binary (per instructions from the documentation) and had to remove the old snap script:
After that
docker-compose
works fine, but it seemssnap remove
didn’t clean up very well.sudo -i helped me
@prvak’s solution worked for me. Muchas gracias!
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.
This worked on Mac (M1)
Thanks @paradoxministry !
I reproduced this problem on OSX Big Sur 11.4 with Docker for Mac 3.5.2.
Re-installing
docker-compose
with brew did NOT work for me. What did work was disablingDocker Compose v2
in my Docker for Mac preferences:Same problem on macOS.
In my case the
docker-compose.yml
file is in the immediate parent of the working directory.After upgradint Docker Desktop to latest version
The
/user/local/bin/docker-compose
was overriden by docker. To solve this I’ve re-installedbrew reinstall docker-compose
(to installbrew install docker-compose
)yes. the same on on a fresh ubuntu 20.