0

I am building a Debian 9, NGINX, PHP7 FPM containers.

I have this in my php7-fpm docker file (which is based on Debian 9)

The problem occurs (I think) when I have this closing line: ENTRYPOINT ["php7.0-fpm"]

I have used this before in previous docker build but this one is causing issues with the following error: $ docker run -t linxlad/php7-fpm C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"php7.0-fpm\": executable file not found in $PATH".

My Docker file:

#
# PHP-FPM Dockerfile
#

# Pull base image.
FROM linxlad/nginx

# No tty
ENV DEBIAN_FRONTEND noninteractive

RUN echo "deb http://ftp.us.debian.org/debian/ stretch main contrib non-free" >> /etc/apt/sources.list
RUN echo "deb-src http://ftp.us.debian.org/debian/ stretch main contrib non-free" >> /etc/apt/sources.list

RUN wget https://www.dotdeb.org/dotdeb.gpg && apt-key add dotdeb.gpg

RUN apt-get update && \
    apt-get -y install software-properties-common && \
    apt-get update

# Install PHP
RUN apt-get -y --force-yes install php7.0-cli php7.0-fpm php7.0-dev php7.0-mcrypt php7.0-mbstring \
    php7.0-bz2 php7.0-xml php7.0-common php7.0-mysql php-pear

# Phalcon
RUN curl -s "https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh" | bash && \
    apt-get update && \
    apt-get -y --force-yes install php7.0-phalcon

RUN echo "extension=phalcon.so" >> /etc/php/7.0/fpm/conf.d/40-phalcon.ini

RUN sed -i '/daemonize /c \
daemonize = no' /etc/php/7.0/fpm/php-fpm.conf

# tweak php-fpm config
RUN sed -i -e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php/7.0/fpm/php.ini && \
    sed -i -e "s/upload_max_filesize\s*=\s*2M/upload_max_filesize = 100M/g" /etc/php/7.0/fpm/php.ini && \
    sed -i -e "s/memory_limit = .*/memory_limit = 1024M/g" /etc/php/7.0/fpm/php.ini && \
    sed -i -e "s/memory_limit = .*/memory_limit = 1024M/g" /etc/php/7.0/cli/php.ini && \
    sed -i -e "s/post_max_size\s*=\s*8M/post_max_size = 100M/g" /etc/php/7.0/fpm/php.ini && \
    sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php/7.0/fpm/php-fpm.conf && \
    sed -i -e "s/;catch_workers_output\s*=\s*yes/catch_workers_output = yes/g" /etc/php/7.0/fpm/pool.d/www.conf && \
    sed -i -e "s/pm.max_children = 5/pm.max_children = 9/g" /etc/php/7.0/fpm/pool.d/www.conf && \
    sed -i -e "s/pm.start_servers = 2/pm.start_servers = 3/g" /etc/php/7.0/fpm/pool.d/www.conf && \
    sed -i -e "s/pm.min_spare_servers = 1/pm.min_spare_servers = 2/g" /etc/php/7.0/fpm/pool.d/www.conf && \
    sed -i -e "s/pm.max_spare_servers = 3/pm.max_spare_servers = 4/g" /etc/php/7.0/fpm/pool.d/www.conf && \
    sed -i -e "s/pm.max_requests = 500/pm.max_requests = 200/g" /etc/php/7.0/fpm/pool.d/www.conf && \
    sed -i -e "s/user = www-data/user = web/g" /etc/php/7.0/fpm/pool.d/www.conf && \
    sed -i -e "s/group = www-data/group = staff/g" /etc/php/7.0/fpm/pool.d/www.conf && \
    echo "date.timezone = \"Europe/London\"" >> /etc/php/7.0/fpm/php.ini

# fix ownership of sock file for php-fpm
RUN sed -i -e "s/;listen.mode = 0660/listen.mode = 0750/g" /etc/php/7.0/fpm/pool.d/www.conf && \
    find /etc/php/7.0/cli/conf.d/ -name "*.ini" -exec sed -i -re 's/^(\s*)#(.*)/\1;\2/g' {} \;

RUN sed -i '/^listen /c \
    listen = 9000' /etc/php/7.0/fpm/pool.d/www.conf

RUN sed -i 's/^listen.allowed_clients/;listen.allowed_clients/' /etc/php/7.0/fpm/pool.d/www.conf

EXPOSE 9000

VOLUME ["/etc/php-fpm.d", "/var/log/php-fpm", "/var/www/html"]

ENTRYPOINT ["php7.0-fpm"]

I found something similar but it does not work for me? Executable file not found in $PATH

Anyone know a solution?

Community
  • 1
  • 1
Kal
  • 2,239
  • 6
  • 36
  • 74

1 Answers1

2

Have you tried specifying the absolute path of the fpm file in the ENTRYPOINT ?

Something like ENTRYPOINT ["/etc/init.d/php7.0-fpm"]

Nagendra Kakarla
  • 1,011
  • 3
  • 10
  • 17
  • I have just tried `CMD service php7.0-fpm start && nginx -g "daemon off;"` and got the following error `nginx: invalid option: "/bin/sh"`. Let me try your suggestion. – Kal May 12 '17 at 14:44
  • I'm guessing it's this? `ENTRYPOINT ["/etc/init.d/php7.0-fpm", "start"]` but what keeps the container running? How can I keep it up, it no longer errors but the container isn't running after I up it. I need something to hook into to keep it up? – Kal May 12 '17 at 14:56
  • 1
    If the container is not running then, the init failed. You should be able to check that from - docker logs – Nagendra Kakarla May 12 '17 at 14:58