0

I have this part of my docker-compose file:

php-fpm:
    build: ./docker/php
    container_name: php-fpm-symfony
    links:
        - db
    ports:
        - 9000:9000
        - 8448:8448
        - 8000:8000
    working_dir: /var/www/html/
    volumes:
        - .:/var/www/html
    volumes_from:
        - data
    tty: true
    env_file:
        - ./docker.env
    entrypoint: /command.sh

And here is my Dockerfile:

FROM php:7.0.8-fpm
ADD command.sh /command.sh
RUN chmod 777 /command.sh
ENTRYPOINT ["/command.sh"]

My command.sh at the root

#!/usr/bin/env bash
git config --global user.email "${gitEmail}"
git config --global user.name "${gitName}"

I need to execute my command.shfile when I'm doing my docker-compose up -d

But it does not work that way.

ERROR: for nginx Cannot link to a non running container: /php-fpm-symfony AS /nginx/php-fpm ERROR: Encountered errors while bringing up the project. Error response from daemon: Container 7c2a9bffa9664c4007d685f56d17e4659c6dd7021962d6462177480f5a821d44 is not running

How can I make this work?

2
  • Could you share the content of command.sh it seems that the script is indeed invoked but it is finished immediately Commented Jul 28, 2016 at 21:52
  • @cml.co I just did it ... Commented Jul 28, 2016 at 21:56

1 Answer 1

3

A docker container exits when its main process finishes.

Your script is certainly finishing and no php process is launched. Try adding a call to php-fpm

#!/usr/bin/env bash
git config --global user.email "${gitEmail}"
git config --global user.name "${gitName}"
php-fpm
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.