in order to facilitate development, we plan to create a LNMP environment based on docker, which makes it much more convenient to change computers or unify the team"s development environment.
choreographed a docker-compose.yaml file with nginx, php-fpm, mysql, redis and other services. All of them have been done except php-fpm.
tell me about the process:
- first of all, pull"s official php image
php:7.x-fpm. Create images and containers, and have no problems connecting to other containers .
- but the PHP extension (extension) supported by this image is too few, and many commonly used ones do not (such as the gd library)
- is installed by setting
RUN docker-php-ext-install gdin Dockerfile, indicating that
libpnglibrary is missing.
- enter the container and install it with
yum install-y libpng, prompting
yumis an unknown command
rpm xxx, prompting that
rpmis an unknown command.
then change the way of thinking and plan to create your own
php-fpm image based on the
centos image, so:
- pull official
centos 7.ximage, enter the container to download the php source code package, and compile and install it smoothly
- start the container and find that the
php-fpmservice cannot be opened automatically.
entrypointdefine commands (not at the same time):
/ path/to/sbin/php-fpm-y / path/to/etc/php-fpm.conf. When the container starts, the service fails to start, and the prompt message is equivalent to entering:
php-fpm-h, all related parameters .
I feel that this problem is because
php-fpm is in the
sbin directory and can only be run by a superuser, but executing
entrypoint when the container is started is not a superuser, so it fails
, which causes me to enter php container to manually open the service every time I start container orchestration
I really don"t know what to do. I hope all of you can give me some hints:
1. How do I make the
centos container automatically open the
php-fpm service when it starts?
2. Or instead of using this idea, we can use other solutions
Thank you very much, thank you ~