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.
Related
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
I have a problem using docker on macOs Mojave with Docker Desktop community Version 2.0.0.3.
I followed this tutorial:
https://www.cloudreach.com/en/insights/blog/containerize-this-how-to-use-php-apache-mysql-within-docker-containers/
and then did docker-compose up.
So far it's working great. It's using my port I want to and it's using the index.php in public_html folder.
So I did the following:
docker stop $(docker ps -aq) && docker rm docker ps -aq -f status=exited\
All containers were deleted.
Now I did copied that cloned folder with rsync to a new folder with exactly the same content rsync -acv php-apache-mysql-containerized/ php-apache-mysql-containerized-2/.
When I go in that new folder and executing docker-compose up it would load correctly but don't use my index.php in that public_html folder.
It's just saying "It works" instead using my code in index.php.
When I go back to the previous folder where I cloned it first from Github and compose-up, then the index.php is used.
It's driving me insane!
I tried these steps:
Turned off localhost on my machine using sudo apachectl stop.
Used absolute path in my file .env instead of ./public_html
looked with docker inspect into that apache container, but in both versions Volumes are always null.
Used docker-compose down and afterwards docker-compose up --force-recreate
I don't see the point here why a exact copy won't use the index.php
I would really appretiate any help to understand und debug this problem.
Thank you.
I am new to docker and am trying to get a few containers up and running using a docker-compose.yml file. But when i run the following command inside the cocker toolbox cli
docker-compose.yml up
I get the following errors:
As you can see, if I run the command
docker-compose -v
I get the version and build info which means it has been installed.
I have googled a lot but failed to find any solution. Kindly suggest.
Thanks in advance
You're trying to run the .yml file. Compose doesn't work like that.
Just run: docker-compose in the directory where docker-compose.yml resides. Docker-compose will automatically find the file.
You tried to run a yml file (which at best, bash interprets as a script). You need to run docker-compose, not docker-compose.yml. The latter is the input config file to the former.
docker-compose config
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.
How can I open/run a YML compose file on my computer? I've installed Docker for Windows and Docker tools but couldn't figure out how.
If you are asking how to open YAML files, then you can use some common editors like NotePad++ in windows or vim in linux.
If your question is about running the compose yaml file, then run this command from the directory where compose file is residing:
docker-compose -f {compose file name} up
You can avoid -f if your filename is docker-compose.yml
To manage .yml files you have to install and use Docker Compose.
Installation instructions can be found here: https://docs.docker.com/compose/install/
After the installation, go to your docker-compose.yml directory and then execute docker-compose up to create and start services in your docker-compose.yml file.
If you need more information, take a look to Docker Compose docs: https://docs.docker.com/compose