4

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.

1
  • why do you use restart: always in php? why dont you run composer in "travellizy_php"? Commented Feb 22, 2017 at 13:36

1 Answer 1

9

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]

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

2 Comments

"IMO php-cli and composer services are redundant. You can use php service for your needs." Not disagreeing, but why do you believe this? What's the difference between Docker php, Docker php-cli and Docker php-fpm, see also question, here: devops.stackexchange.com/questions/9505/…
@therobyouknow the php-fpm docker image can handle all of the required things: running script in CLI mode and running composer (ie via the phar archive).

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.