1
votes

I have made a docker compose file with three services web( nginx service) app(php-laravel-folder-service) database(mysal-service) for every service i create a dockerfile web.dockerfile app.dockerfile database.dockerfile.

The problem is: in the app.dockerfile i want to install composer and execute the composer install command or php composer.phar install command and every time i got this error: ERROR: Service 'app' failed to build: The command '/bin/sh -c composer.phar install' returned a non-zero code: 12

1
try to rename ittrigun117
Rename the composer.phar file ?? because i did move it to the /bin folder but it stil dosn't work and i also grap the composer/composer from the docker HUB this work but the version of php is lower from the version that laravel required .Zenzamy Othmane

1 Answers

2
votes

Try moving the composer.phar to /usr/local/bin/ this will allow you to call the composer globally. It would look something like this in your Dockerfile. Just make sure you are running this with your working directory set as your apps root

RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
RUN composer install