A
A
amorphine2016-12-24 02:58:07
Nginx
amorphine, 2016-12-24 02:58:07

Docker: alpine+nginx+php-fpm - nginx not taking off?

A new person in docker, creating my own universal environment for projects. Apache + Ubuntu - there were no problems, but there are some difficulties with Alpine Linux.
Here is my docker file:

FROM php:5.6-fpm-alpine

RUN apk update && apk add autoconf file g++ gcc binutils isl libatomic libc-dev musl-dev make re2c libstdc++ libgcc libcurl binutils-libs mpc1 mpfr3 gmp libgomp coreutils freetype-dev libjpeg-turbo-dev libltdl libmcrypt-dev libpng-dev openssl-dev libxml2-dev expat-dev

RUN yes | pecl install xdebug \
    && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
    && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
    && echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini

RUN docker-php-ext-configure mcrypt \
  && docker-php-ext-install mcrypt \
  && docker-php-ext-enable mcrypt

RUN docker-php-ext-configure mysqli \
  && docker-php-ext-install mysqli \
  && docker-php-ext-enable mysqli

RUN apk add curl-dev

RUN docker-php-ext-configure curl \
  && docker-php-ext-install curl \
  && docker-php-ext-enable curl

RUN pecl install mailparse-2.1.6 \
    && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name mailparse.so)" > /usr/local/etc/php/conf.d/mailparse.ini \
    && docker-php-ext-enable mailparse

RUN docker-php-source delete

RUN apk add nano nginx

ENV TERM=xterm

RUN apk add bash

In the container, nginx itself does not start yet (probably, an entrypoint is needed), but the fact is that it does not start manually either:
bash-4.3# nginx
nginx: [emerg] open() "/run/nginx/nginx.pid" failed (2: No such file or directory)
bash-4.3# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] open() "/run/nginx/nginx.pid" failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed

bash-4.3# /etc/init.d/nginx start
 * WARNING: nginx is already starting
bash-4.3# ps aux                 
PID   USER     TIME   COMMAND
    1 root       0:00 php-fpm: master process (/usr/local/etc/php-fpm.conf)
    7 www-data   0:00 php-fpm: pool www
    8 www-data   0:00 php-fpm: pool www
    9 root       0:00 bash
  102 root       0:00 ps aux
bash-4.3#

bash-4.3# ls /run
bash-4.3#

logs
2016/12/23 23:44:34 [emerg] 63#0: open() "/run/nginx/nginx.pid" failed (2: No such file or directory)
2016/12/23 23:45:52 [emerg] 71#0: open() "/run/nginx/nginx.pid" failed (2: No such file or directory)
2016/12/23 23:49:30 [emerg] 82#0: open() "/run/nginx/nginx.pid" failed (2: No such file or directory)
2016/12/23 23:49:41 [emerg] 83#0: open() "/run/nginx/nginx.pid" failed (2: No such file or directory)
2016/12/23 23:49:55 [emerg] 84#0: open() "/run/nginx/nginx.pid" failed (2: No such file or directory)
2016/12/23 23:53:58 [emerg] 86#0: open() "/run/nginx/nginx.pid" failed (2: No such file or directory)
2016/12/23 23:54:00 [emerg] 87#0: open() "/run/nginx/nginx.pid" failed (2: No such file or directory)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey, 2016-12-24
@amorphine

What is it that you don't understand about the error? there is no nginx.pid file in the /run/nginx/ directory and most likely the /run/nginx/ directory does not exist... Probably /var/run/nginx so you need to set the path of the pid file for nginx

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question