Closed asheroto closed 3 years ago
this happens because the ~/.composer folder owner is root. when copied to the container it still has the root owner
simple workaround is to run ./bin/root chown -R app:app /var/www/.composer/
after the failed install and then
run your one line install command again
Composer should never be owned by root, on Linux, Mac, or anywhere else. Are you running the curl line as root? If so, you shouldn't be.
Thank you for your reply.
I'm missing something here, and I too believe it's a permissions issue.
When I run bin/download 2.4.2
it can't find Docker, so I tried sudo bin/download 2.4.2
but also received errors. I am new to Magento but familiar with Linux.
user->~$ bin/download 2.4.2
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
user->~$ sudo bin/download 2.4.2
Stopping user_app_1 ... done
Stopping user_phpfpm_1 ... done
Stopping user_db_1 ... done
Stopping user_rabbitmq_1 ... done
Stopping user_elasticsearch_1 ... done
Stopping user_redis_1 ... done
Starting user_rabbitmq_1 ... done
Starting user_redis_1 ... done
Starting user_elasticsearch_1 ... done
Starting user_db_1 ... done
Starting user_phpfpm_1 ... done
Starting user_app_1 ... done
Composer authentication required (repo.magento.com public and private keys):
Username: my_api_public_key
Password: my_api_private_key
Composer auth has been setup.
Creating a "magento/project-community-edition=2.4.2" project at "./"
[InvalidArgumentException]
Project directory "/var/www/html/." is not empty.
create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]
user->~$ ls /var/www
Permissions Size User Group Date Modified Name
drwxr-xr-x - user user 2021-04-13 09:04 html
Directory listings w/perms:
user->~$ cd /var/www
user->www$ ls
Permissions Size User Group Date Modified Name
drwxr-xr-x - user user 2021-04-13 09:04 html
user->www$ cd html
user->html$ ls
user->html$
Docker output:
user->html$ docker ps
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json: dial unix /var/run/docker.sock: connect: permission denied
user->html$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cb5a749cdadd markoshust/magento-nginx:1.18-4 "/docker-entrypoint.…" 4 hours ago Up 4 minutes 80/tcp, 0.0.0.0:80->8000/tcp, :::80->8000/tcp, 0.0.0.0:443->8443/tcp, :::443->8443/tcp user_app_1
f4313f298bd0 markoshust/magento-php:7.4-fpm-5 "docker-php-entrypoi…" 4 hours ago Up 4 minutes 9000-9001/tcp user_phpfpm_1
8f45e6380dfc percona:5.7 "/docker-entrypoint.…" 4 hours ago Up 4 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp user_db_1
ce4550c73d67 rabbitmq:3.7-management-alpine "docker-entrypoint.s…" 4 hours ago Up 4 minutes 4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, :::5672->5672/tcp, 15671/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp user_rabbitmq_1
6ea341c58aa0 markoshust/magento-elasticsearch:7.7.1-0 "/tini -- /usr/local…" 4 hours ago Up 4 minutes 0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 0.0.0.0:9300->9300/tcp, :::9300->9300/tcp user_elasticsearch_1
7f6f7cba4259 redis:5.0-alpine "docker-entrypoint.s…" 4 hours ago Up 4 minutes 6379/tcp user_redis_1
I feel like I need to give user
access to Docker, right now I can only access docker commands with sudo
or as root, of course.
Thanks for your help!
I have to correct myself. The folder is not copied, but synced. We should take another closer look. In my case I have two users for example Bob with id 1000 and James with id 1001.
@asheroto this is your error: user->html$ docker ps Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json: dial unix /var/run/docker.sock: connect: permission denied
It appears you don't have Docker setup properly, see postinstall commands at https://docs.docker.com/engine/install/linux-postinstall/
Thank you
this happens because the ~/.composer folder owner is root. when copied to the container it still has the root owner
simple workaround is to run
./bin/root chown -R app:app /var/www/.composer/
after the failed install and then run your one line install command again
This was the only thing that make it works. Thanks!
I re-architected how Composer is setup with the Composer 2 support, so perhaps this will help with the above error. https://github.com/markshust/docker-magento/commit/4e029a7c5fedefbf3fb93646a3618e9928fc5656#diff-e819b988ce0448773903f74f99cb7b946fe092468326e2d10054d281cd6890e1L91
But Composer should never be ran as root, ...on the host, in the container, or anywhere else. So this one was user error 🤓
@markshust haha, indeed. Thanks, I will try this out.
andres@andres-HP-Pavilion-Laptop-14-bk0xx:~/Documentos/Magetnto2$ ./bin/root chown -R app:app /var/www/.composer/ andres@andres-HP-Pavilion-Laptop-14-bk0xx:~/Documentos/Magetnto2$ sudo bin/download 2.4 [sudo] contraseña para andres: Stopping magetnto2_phpfpm_1 ... done Stopping magetnto2_app_1 ... done Stopping magetnto2_rabbitmq_1 ... done Stopping magetnto2_elasticsearch_1 ... done Stopping magetnto2_db_1 ... done Stopping magetnto2_mailcatcher_1 ... done Stopping magetnto2_redis_1 ... done Starting magetnto2_elasticsearch_1 ... done Starting magetnto2_rabbitmq_1 ... done Starting magetnto2_redis_1 ... done Starting magetnto2_phpfpm_1 ... done Starting magetnto2_db_1 ... done Starting magetnto2_mailcatcher_1 ... done Starting magetnto2_app_1 ... done
Composer authentication required (repo.magento.com public and private keys): Username: 88411650cd52e8b831ee41d8c6f8c741 Password: 6fa5c1745e95be45de0be6cd630138d6
Composer auth has been set up. Creating a "magento/project-community-edition=2.4" project at "./" Installing magento/project-community-edition (2.4.0)
Installing magento/project-community-edition (2.4.0): Extracting archive Created project in /var/www/html/. Loading composer repositories with package information Info from https://repo.packagist.org: #StandWithUkraine Updating dependencies Your requirements could not be resolved to an installable set of packages.
Problem 1
andres@andres-HP-Pavilion-Laptop-14-bk0xx:~/Documentos/Magetnto2$
this happens because the ~/.composer folder owner is root. when copied to the container it still has the root owner
simple workaround is to run
./bin/root chown -R app:app /var/www/.composer/
after the failed install and then run your one line install command again
bin/fixowns: This will fix filesystem ownerships within the container. i have fixed this by running this docker command
@expertsnarensharma ok good to know this!
bin/fixowns <- please remember this solved my 6h fighting with this problem...
I found that .composer in /Users/$username/.composer belong to root And i run this cmd sudo chown -R $username .composer change it to be mine. It run like a magic ! Hope it help you
Thanks for the comment @Hungnguyen999. It seems that many devs install Composer as root, but that is very wrong! Your command fixes it to be properly installed.
See https://getcomposer.org/doc/faqs/how-to-install-untrusted-packages-safely.md
Description Brand new Linux VM, Debian 10, with Docker + Docker-Compose.
Tried entering
curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- magento.test 2.4.2
Failed with below.
Following https://github.com/markshust/docker-magento/blob/master/SETUP.md
Upon entering
bin/download 2.3.4
Even tried creating /var/www/.composer/config.json and setting its perms to 777 (to test). Still fails.
Tried
sudo bin/download 2.3.4
and it still fails. Tried it as root (last hope) and it fails.Same result with
bin/download
andbin/download 2.3.0
.Steps To Reproduce See description.
Expected Result Successful install/setup
Actual Result Failed, see description