0

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?

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.