Reputation: 51
I tried to install composer in a dockerfile using this code
FROM php:8.0-fpm
WORKDIR /app/php
RUN set update && set add curl && \
curl -sS https://getcomposer.org/installer --version=2.0.2 | PHP
but when I exec the container I find that the composer isn't installed
root@70c:/app/php# composer -v
bash: composer: command not found
What's wrong?, and how can I resolve this?
Upvotes: 0
Views: 1829
Reputation: 1058
This will download the composer.phar file in the directory you are, in your case /app/php
If you want to have global access to composer you should move it to /usr/local/bin directory and make it executable.
chmod +x composer.phar
sudo mv composer.phar /usr/local/bin/composer
Upvotes: 1