Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run docker-compose with php-fpm and php-cli?

I need to run docker-compose with two containers,- php-fpm and php-cli. Although I need another container with composer.

When I run docker-compose up -d - container with php-cli become always restarting and composer container just stops.

like image 820
troitskyA Avatar asked Jan 04 '23 11:01

troitskyA


1 Answers

PHP cli is not running in daemon mode. You run it, and then it stops. Next, Docker tries to restart it (you've set restart: always policy for php-cli). :)

IMO php-cli and composer services are redundant. You can use php service for your needs. Simply run docker-compose run php php [path to script]

like image 113
radmen Avatar answered Jan 07 '23 01:01

radmen