Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php-fpm docker容器中如何启动客户端? #25

Open
haroldchenhao opened this issue Nov 29, 2019 · 2 comments
Open

php-fpm docker容器中如何启动客户端? #25

haroldchenhao opened this issue Nov 29, 2019 · 2 comments

Comments

@haroldchenhao
Copy link

对 docker 自启动的文档不太理解。启动脚本是docker-php-entrypoint

@haroldchenhao
Copy link
Author

docker-php-entrypoint 的脚本内容是
#!/bin/sh
set -e

first arg is -f or --some-option

if [ "${1#-}" != "$1" ]; then
set -- php-fpm "$@"
fi
exec "$@"

一般情况下启动命令是 docker-php-entrypoint php-fpm,试过直接在docker-php-entrypoint里面直接追加启动命令,但追加的启动命令并没有执行,进入容器后手动执行命令可以生成.env。如何改造才能在启动容器时就可以自动生成.env?

@xiaodx12
Copy link
Contributor

docker-php-entrypoint 的脚本内容是
#!/bin/sh
set -e

first arg is -f or --some-option

if [ "${1#-}" != "$1" ]; then
set -- php-fpm "$@"
fi
exec "$@"

一般情况下启动命令是 docker-php-entrypoint php-fpm,试过直接在docker-php-entrypoint里面直接追加启动命令,但追加的启动命令并没有执行,进入容器后手动执行命令可以生成.env。如何改造才能在启动容器时就可以自动生成.env?

docker-php-entrypoint 的脚本内容是
#!/bin/sh
set -e

first arg is -f or --some-option

if [ "${1#-}" != "$1" ]; then
set -- php-fpm "$@"
fi
exec "$@"

一般情况下启动命令是 docker-php-entrypoint php-fpm,试过直接在docker-php-entrypoint里面直接追加启动命令,但追加的启动命令并没有执行,进入容器后手动执行命令可以生成.env。如何改造才能在启动容器时就可以自动生成.env?

在这个启动脚本里面加入下面的脚本,注意apollo启动脚本start.php的路径
if [ -f "/path/to/start.php" ]; then
apollo_ps=$(ps -aux | grep -c "php /path/to/start.php")
if [ $apollo_ps -eq 1 ]; then
php /path/to/start.php &
fi
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants