Docker-compose can't find suitable file, even though it exists - docker

So I am running ubuntu 18.04 lts on windows 10 through hyper-v and I'm trying to run the docker compose command through the terminal. When inside the docker folder and I run ls, it says there is a docker-compose.yml file. Still when I run docker compose command, it says no suitable configuration file is found.
docker-compose up -d
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
I'm using docker version 18.09.0 and docker compose version 1.22.0

On Ubuntu Ubuntu 18.04.2 LTS I was facing the same issue. I don't know the exact reason but Docker and Docker Compose installed with snap was not working.
sudo snap remove docker && sudo snap remove docker-compose
Installed docker from Officials Docs here and compose from here via apt and and now my Docker Compose file start working

Found out the problem was using shared folder functionality with Hyper V and windows 10. For some reason docker won't work when the docker-compose.yml file is located inside that, however when I move it outside of the shared(e.g. home directory) folder it does work. So if I want to use the docker file I have to place it outside the shared folder to make it work. Rest of the project runs as expected, so a little workaround ......

Was getting the same error on Ubuntu 20.04. I could not use apt to install docker-compose (Forbidden errors on apt's sources.list and out of my control) so had to install docker-compose with snap
sudo snap install docker
That is a "caveat" of docker installed with snap. From docker-snap README: "All files that docker needs access to should live within your $HOME folder". So that is expected behavior.
Move your project to $HOME folder. For example, I had my project in /usr/local/src/my_project and had to move to ~/some_folder/my_project and then could run docker-compose.

It will be a bit stupid answer I believe but as I am new to using docker desktop on windows. I was trying to run a script file using Ubuntu distro 20.04 LTS. the path I was providing was not correct. because windows user will use path like this in my case C:\Users\usera\Desktop\Terminology-service\ols but here when I changed it to /mnt/c/Users/usera/Desktop/Terminology-service/ols it worked.

Related

docker-compose only works if yml file in home directory

For some reason, on Ubuntu 20.04 docker-compose up only works if my docker compose yaml file is in the user's home directory.
I've uninstalled docker, installed it with snap, installed with apt and no difference.
Why is this? I've never seen this on any other server and for some reason this happens here.
How do I fix this so I can run docker-compose from a directory containing a docker-compose.yml file and have it read the pwd?
I have tried the -f option and it does not help.

docker-compose docker-entrypoint-initdb.d Permission denied

I am trying to run the puppet pupperware suite (all 3 servers/puppet server/puppet DB/DB server).
I am using the official Yaml file provided by puppetlabs for docker compose : https://github.com/puppetlabs/pupperware/blob/master/docker-compose.yml
When I run that Yaml file in docker compose however, I am running into the following error (from docker-compose logs):
postgres_1 | ls: cannot open directory '/docker-entrypoint-initdb.d/': Permission denied
And as a result, the build fails (only the puppet server comes up, but not the other ones).
My docker host is a Fedora 33 virtual machine running inside a Proxmox environment. Proxmox runs on the physical host.
I have disabled SELinux, and I am running docker (moby) rootless. My local user (uid 1000) can run docker without sudo.
I believe I need to set permission in the container (probably via a Dockerfile) but I am not sure how to change that and I am not sure how to use a Dockerfile and docker-compose simultaneously.
thank you for your help
The docker-compose file is from the Puppet 6 era. The docker images that the Pupperware setup currently pulls, are latest, which is Puppet 7.
I got my pre-existing setup functioning again by changing the image names to:
puppet/puppetserver:6.14.1
postgres:9.6
puppet/puppetdb:6.13.1
Maybe this works for you as well.
well, since it's been a month and you have no answers I will tell try to help you with what I know.
You should put a Dockerfile in the root of your project. It contains commands to be run by the docker daemon AND the commands run by the linux inside the container. Then it runs through the contents of your docker-compose.yml and runs the commands in there.
So to solve the permission problem you should add RUN, which executes the linux command in Bash and add data to the folder.
Also look at this answer

Docker device path differs depending on commands

After recent Docker update (Docker Desktop for Mac) my stack broke.
I'm using my docker-compose config in two ways - with up command and with run command to execute some operations via containers (when it's not up yet).
I'm getting error:
ERROR: Configuration for volume my_code specifies "device" driver_opt /Users/me/Projects/project/backend/my_code, but a volume with the same name uses a different "device" driver_opt (/host_mnt/Users/me/Projects/project/backend/my_code). If you wish to use the new configuration, please remove the existing volume "my_code" first:
I have configured docker-compose with volumes shared between containers.
volumes:
my_code:
driver: local
driver_opts:
type: none
device: ${PWD}/project/backend/my_code
o: bind
Looks like for some reason up and run commands get's different path from $PWD in docker-compose. One get's prefixed with /host_mnt and the other doesn't. Is this a bug or maybe my config is invalid?
Docker for Mac 2.4.0.0 stable
Docker Compose 1.27.4
Catalina
I just had the same issue with the prefix /host_mnt on a Ubuntu system.
This is something related to Docker Desktop.
The solution for me was to uninstall docker and Docker desktop according to the documentation
https://docs.docker.com/desktop/install/ubuntu/
https://docs.docker.com/engine/install/ubuntu/
And afterwards also delete the docker config files manually.
rm -rf ~/.docker
Then I just installed the docker engine instead of the docker desktop.
The problem was caused by an update on Docker Desktop that adds that /host_mnt prefix for compatibility with Windows users.

mounted volumes are only partially appearing and empty using docker-compose on WSL

Here is my docker-compose file (sorry for the images but the WSL terminal won't let me copy-paste indented text):
The intention being that external_stuff contains my mounts directory. When I look in the mounts directory I clearly see my drives:
However, when I run docker-compose up I only see a single folder ("c") as opposed to all of my drives, and when I navigate into that folder it appears empty:
I tried running sudo -E docker-compose up but that makes no difference.
What's going on here, and how do I fix it?
My system:
Docker desktop version 2.1.0.5
Windows build 1903 / OS Build 18362.476
I think I'm running wsl 1 but I really have no idea. If I run wsl -l from a powershell it spits out a bunch of command line options.
I'm running Ubuntu 18.04.2 LTS directly from the "Ubuntu" app in windows.
Dockerfile:
FROM python:3
Docker Desktop is running on a VM and you need to share your drives with it.
When running Docker Desktop through WSL, you will still need to share the drives you are using.
For this, you simply have to go into Docker Desktop Settings > Shared Drives and then allow sharing your drives.
Then you can work on Docker Desktop through WSL with linux commands, linux paths, etc.
Disclaimer : WSL and Docker Desktop are really unstable, with sharing volumes, permissions, inotify events, etc. You can find more information about theses problems on the answer of this question : Docker is not recompiling upon changing anything in angular project in windows

Run docker-compose on Windows 7

I'm using Docker Toolbox to run docker containers on Windows. When I try to perform docker-compose up Docker cannot find docker-compose.yml. I must cd into container's directory or specify the file path using -f argument. How to get the path?
docker info shows Root Dir as /mtn/sda1/bla/bla which is virtual path and doesn't exist on my PC.
UPD: solved
You may have simply forgot to save the docker-compose.yml. check this first. Try this solution, it worked for me https://github.com/docker/compose/issues/129
hope you get it sorted

Resources