I am looking for a Dockerfile
which has Nginx, Php7, MongoDB & Redis enabled on Alpine. Managed to get below but while executing it I see below errors. Please suggest.
Dockerfile:-
FROM trafex/alpine-nginx-php7 USER root RUN apk add --update --virtual build_deps bash gcc g++ autoconf make openssl-dev pcre-dev mongodb && docker-php-source extract && /bin/bash -lc "pecl install mongodb" && docker-php-ext-enable mongodb && docker-php-source delete && apk del build_deps && rm -rf /var/cache/apk/* && rm -rf /tmp/* COPY ./ /usr/share/nginx/html COPY ./default.conf /etc/nginx/conf.d/ COPY ./php-fpm.conf-7.0 /etc/php-fpm-7.0.d/ COPY ./php-fpm.conf /etc/php-fpm-7.0.d/
Error:-
/bin/sh: docker-php-source: not found /bin/bash: pecl: command not found
Referred:- https://github.com/TrafeX/docker-php-nginx/blob/master/Dockerfile
After commenting from line 2 to line 10, I managed to get Nginx running but In logs I could see below error.
[error] 9#9: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: _, request: "GET /fpm-ping HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:8080"
php-fpm.conf-7.0
upstream php-fpm { server 127.0.0.1:9000; }
Advertisement
Answer
In alpine linux pecl
is provided by php7-pear
package; add it to your apk add
command