泊坞窗 - 运行一个容器中时执行一个bash
问题描述:
我有我的docker-compose
文件的这一部分:泊坞窗 - 运行一个容器中时执行一个bash
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
这里是我Dockerfile:
FROM php:7.0.8-fpm
ADD command.sh /command.sh
RUN chmod 777 /command.sh
ENTRYPOINT ["/command.sh"]
我command.sh
在根
#!/usr/bin/env bash
git config --global user.email "${gitEmail}"
git config --global user.name "${gitName}"
我需要执行我的command.sh
文件,当我在做我的docker-compose up -d
但它不起作用。
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
我该如何做这项工作?
答
泊坞窗容器在其主进程完成时退出。
你的脚本当然是完成,没有启动PHP进程。尝试添加调用php-fpm
#!/usr/bin/env bash
git config --global user.email "${gitEmail}"
git config --global user.name "${gitName}"
php-fpm
你能分享的内容'command.sh'似乎脚本调用确实,但它会立即 –
@ cml.co我只是做了它完成... – Kevin