Zenzamy Othmane
Zenzamy Othmane

Reputation: 307

Docker + Laravel + Composer

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

Upvotes: 1

Views: 1548

Answers (1)

Sam
Sam

Reputation: 81

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

Upvotes: 2

Related Questions