任何人都可以帮助我了解为什么我的Docker容器以状态0退出或对此进行进一步调试。我试图在CentOS7上运行Phalcon框架没有运气:
php-phalcon exited with code 0
docker-compose-yml是这样的:
...
php-phalcon:
build: docker/php-phalcon
container_name: php-phalcon
working_dir: /application
volumes:
- ./application:/application
- ./docker/php-phalcon/php-ini-overrides.ini:/etc/php/7.3/fpm/conf.d/99-overrides.ini
Dockerfile如下:
FROM centos:centos7
ENV TERM=linux
RUN yum -y install deltarpm \
&& yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm \
&& yum -y install epel-release yum-utils \
&& yum-config-manager --disable remi-php54 \
&& yum-config-manager --enable remi-php73 \
&& yum -y install \
ca-certificates \
curl \
unzip \
php \
php-cli \
php-common \
php-mbstring \
php-xml \
php-json \
php-apcu \
php-apcu-bc \
php-mysqlnd \
php-zip \
php-devel \
php-gd \
php-mcrypt \
php-opcache \
php-readline \
php-curl \
php-zip \
php-pear \
php-bcmath \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer global require hirak/prestissimo \
&& composer clear-cache \
&& yum -y clean all \
&& rm -rf /tmp/* /var/tmp/* /usr/share/doc/* ~/.composer
RUN echo 'd /run/php-fpm 755 root root' >> /usr/lib/tmpfiles.d/php-fpm.conf
RUN yum install -y php-fpm \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
COPY overrides.conf /etc/php/7.3/fpm/pool.d/z-overrides.conf
WORKDIR "/application"
RUN curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.rpm.sh | bash
RUN yum update -y \
&& yum install -y php73u-phalcon
CMD ["/usr/sbin/php-fpm", "-O" ]
EXPOSE 9000
类似的配置,但基于Ubuntu的预期工作。
提前谢谢!
通过@RemiCollet建议,我已将php-amp start命令更改为
CMD ["/usr/sbin/php-fpm", "--nodaemonize", "--force-stderr" ]
它不会像以前那样失败,但是不会暴露9000端口