linuxserver/docker-docker-compose

[linuxserver/docker-compose] “Can't find a suitable configuration file in this directory or any parent. Are you in the right directory?”

marfier opened this issue · 21 comments

linuxserver.io

If you are new to Docker or this application our issue tracker is ONLY used for reporting bugs or requesting features. Please use our Discord server for general support.


Expected Behavior

docker-compose should finddocker-compose.yml in the current directory and proceed normally.

Current Behavior

docker-compose does not find docker-compose.yml, even when it’s really there.

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

Even if I use -f to manually define the path of the file, it just shows all the possible commands.

Steps to Reproduce

  1. Install linuxserver/docker-compose using “Recommended” method (sudo curl -L --fail https://raw.githubusercontent.com/linuxserver/docker-docker-compose/master/run.sh -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose )
  2. Write any valid docker-compose.yml file
  3. Run docker-compose config in the same directory as docker-compose.yml

Environment

OS: Fedora CoreOS 32 Stable
CPU architecture: x86_64
How Docker was installed: Included as part of the OS (container Linux distribution)

Command used to create Docker container (run/create/compose/screenshot)

Docker Compose (https://github.com/mailcow/mailcow-dockerized/blob/master/docker-compose.yml)

I can not replicate this issue, it works fine for me when using my normal user or when using sudo.
I tested on a clean debian 10 minimal install, installed docker as per the docker recommendation, and docker-compose using https://github.com/linuxserver/docker-docker-compose#recommended-method
I then created a valid docker-compose.yml and did the following

driz@meet:~$
sudo docker-compose pull
Pulling lan-play2 ... done
driz@meet:~$ docker-compose up -d
Creating lanplay2 ... done
driz@meet:~$

to verify running as sudo, in case a user wishes to do this for some reason, and than not using sudo would both work. they did.

@drizuid it works on Debian, but not on Fedora CoreOS. Isn’t this the whole point of using linuxserver/docker-compose?

Please try the following

docker image rm linuxserver/docker-compose:latest
curl -fsL "https://raw.githubusercontent.com/linuxserver/docker-docker-compose/master/run.sh" -o /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

Then try using compose.

ln: failed to create symbolic link '/usr/bin/docker-compose': Read-only file system

I was on root user.

Sorry, I should have mentioned we probably need sudo in front of all of those commands. Try resetting by running

sudo rm /usr/local/bin/docker-compose
sudo rm /usr/bin/docker-compose

then

sudo docker image rm linuxserver/docker-compose:latest
sudo curl -fsL "https://raw.githubusercontent.com/linuxserver/docker-docker-compose/master/run.sh" -o /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version # should not need sudo for this one

I was on root user when I did these commands at the first them, so it didn’t really make a difference when I ran them as sudo on a regular user:

[core@localhost ~]$ sudo rm /usr/local/bin/docker-compose
[core@localhost ~]$ sudo rm /usr/bin/docker-compose
rm: cannot remove '/usr/bin/docker-compose': No such file or directory
[core@localhost ~]$ sudo docker image rm linuxserver/docker-compose:latest
Error: No such image: linuxserver/docker-compose:latest
[core@localhost ~]$ sudo curl -fsL "https://raw.githubusercontent.com/linuxserver/docker-docker-compose/master/run.sh" -o /usr/local/bin/docker-compose
[core@localhost ~]$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
ln: failed to create symbolic link '/usr/bin/docker-compose': Read-only file system
[core@localhost ~]$ sudo chmod +x /usr/local/bin/docker-compose
[core@localhost ~]$

docker-compose —version does require sudo:

[core@localhost ~]$ docker-compose --version
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create": dial unix /var/run/doscker.sock: connect: permission denied.
See 'docker run --help'.
[core@localhost ~]$
core@localhost ~]$ sudo docker-compose --version
Unable to find image 'linuxserver/docker-compose:latest' locally
latest: Pulling from linuxserver/docker-compose
bec29fbcb7de: Pull complete 
04255341a00e: Pull complete 
a33bacabbc01: Pull complete 
67a79305ada5: Pull complete 
e1b54849fa65: Pull complete 
328f8e6e46cc: Pull complete 
34bb5ca43fdd: Pull complete 
Digest: sha256:54a1c81421167542ee2caec76ad74c67ae254f355368c9ec74a7cb5eceaa3771
Status: Downloaded newer image for linuxserver/docker-compose:latest
docker-compose version 1.26.0, build d4451659
[core@localhost ~]$

The same issue still persists, docker-compose still cannot find the config file. Here are the config file perms:

[core@localhost mailcow-dockerized]$ ls -l docker-compose.yml 
-rw-r--r--. 1 root root 18240 Jun 29 14:38 docker-compose.yml
[core@localhost mailcow-dockerized]$

Here are some other $PATH options, if it is any use:

[core@localhost ~]$ echo $PATH
/var/home/core/.local/bin:/var/home/core/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
[core@localhost ~]$

Why is your file system read only?

@GalacticLion7 I've removed your last comment as it exposes you pretty significantly and this is a public conversation. You can join our discord and potentially see if someone wants to allow you to privately send that info to them.

Please try the commands I posted (that include sudo).

@tobbenb my system shows the same message about a read only file system when I do not use sudo. I should have included it in the original instructions.

@nemchik please see my previous posts. I have run the commands as both root user, and a regular user using sudo.

Also, what I sent out was a DigitalOcean Droplet with a random private key made just to be used for this event. It is meant to all be deleted after this issue ends. I didn’t know that you already had a Fedora CoreOS system set up.

Sorry, I had missed your comment where you had run as root. Try running sudo usermod -aG docker "${USER}" as the core user.

The command succeeded, but it did not make a difference.

Can you run docker-compose --version as core now? (i noticed above that you could not).

If that is successful you should then be able to get the same result from these two commands:

 grep 'linuxserver' /usr/local/bin/docker-compose
 grep 'linuxserver' /usr/bin/docker-compose

which should be

IMAGE="linuxserver/docker-compose:$VERSION"

and if you run

command -v docker-compose

you should see one of the two paths. I see /usr/local/bin/docker-compose on Ubuntu 20.04.

Can you try the docker cli example from here? https://github.com/linuxserver/docker-docker-compose#docker-cli

Perhaps there is something wrong with your pwd mount

[core@localhost mailcow-dockerized]$ ls -l docker-compose.yml 
-rw-r--r--. 1 root root 18240 Jun 29 18:25 docker-compose.yml
[core@localhost mailcow-dockerized]$ sudo docker run --rm \
>   -v /var/run/docker.sock:/var/run/docker.sock \
>   -v "$PWD:$PWD" \
>   -w="$PWD" \
>   linuxserver/docker-compose \
>   up

        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
        
[core@localhost mailcow-dockerized]$ sudo docker-compose config
sudo: docker-compose: command not found
[core@localhost mailcow-dockerized]$

Please try the following

cd
echo $PWD
docker run linuxserver/docker-compose echo $PWD

you should see /home/yourUsername twice.

@GalacticLion7 I put up a test VM and realized it's due to an SELinux issue. You can edit the script you downloaded and add --privileged to the last line, right after docker run

@GalacticLion7 I put up a test VM and realized it's due to an SELinux issue. You can edit the script you downloaded and add --privileged to the last line, right after docker run

Thank you.

@aptalca is it possible to make it work alongside SELinux? Adding --privileged is just giving it extreme rights, which kills the point for SELinux.

It is selinux's job to prevent access to docker sock, which is required for this container to function. It's one or the other. If you find another way, let us know.