laradock
laradock copied to clipboard
Update composer to 2.0
Changed current directory to /home/laradock/.composer Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2
There doesn't seem to be any version setting for composer, meaning that the latest one will be used at build time.
Just try to rebuilt your workspace container running docker-compose build --no-cache workspace
as it is documented here.
Another way would be to update the composer version within a container by running composer self-update --2
and have that switched for you.
The version will switch automatically next time you rebuild a container, though it will still be at 1.x if you keep using the same one that you've built some time ago.
@pjotrsavitski Thank you very much bro.
after I rebuild the workspace with --no-cache still have version 1 installed: Composer version 1.10.5 2020-04-10 11:44:221
running composer self-update --2
got an error message:
[ErrorException] rename(/home/laradock/.composer/cache/composer-temp.phar,/usr/local/bin/composer): Permission denied
@glorand It is strange that rebuilding a container did not work for you. Not sure how to help with that as it worked just fine for me. Maybe someone with better understanding and deeper knowledge of the inner workings will be able to help.
As for the error you have mentioned, it might depend on the user that you ssh into the container with. You might either be a root or run the command with sudo (the second possibility does not seem to be there, at least not for me).
Example: docker-compose exec --user=laradock workspace bash
This line will ssh into that container with shell set to bash and user laradock. That user is not the root, so the possibilities might be somewhat limited.
If you try it without specifying a user docker-compose exec workspace bash
, then you should be a root with all the rights you need.
@pjotrsavitski thanks for your detailed answer. Was my bad, before a no cache rebuild need to stop all running containers. I can confirm that docker-compose build --no-cache workspace
installs the latest version of composer
for those who still don't get composer 2
even after a build --no-cache
make sure you pull the latest laradock/workspace
image you need 😎️
#2817 #2982