2017-09-28 1 views
0

Je crée une base d'image mdocker personnalisée sur (FROM) php:7.0-fpm-alpine image Je dois installer le extention mongodb donc mon Dockerfile a le contenu suivantProblèmes Installation du package mongodb pecl:/tmp/pear/temp/mongodb/configure: ./configure.lineno: ligne 1: erreur de syntaxe: chaîne entre guillemets sans terminaison

FROM php:7.0-fpm-alpine 
MAINTAINER John Doe <[email protected]>  

RUN apk update &&\ 
    apk add --update --virtual build_deps gcc g++ autoconf make openssl-dev pcre-dev &&\ 
    docker-php-source extract &&\ 
    pecl install mongodb && \ 
    docker-php-ext-enable mongodb && \ 
    docker-php-source delete && \ 
    apk del build_deps autoconf gcc g++ make && \ 
    rm -rf /var/cache/apk/* && \ 
    rm -rf /tmp/* 

Mais quand je construis l'image ci-dessus, je reçois la sortie suivante (sortie du paquet alpin installe ont été ommited):

downloading mongodb-1.3.0.tgz ... 
Starting to download mongodb-1.3.0.tgz (927,842 bytes) 
.........................................................................................................................................................................................done: 927,842 bytes 
417 source files, building 
running: phpize 
Configuring for: 
PHP Api Version:   20151012 
Zend Module Api No:  20151012 
Zend Extension Api No: 320151012 
building in /tmp/pear/temp/pear-build-defaultuserfgCbfi/mongodb-1.3.0 
running: /tmp/pear/temp/mongodb/configure --with-php-config=/usr/local/bin/php-config 
checking for grep that handles long lines and -e... /bin/grep 
checking for egrep... /bin/grep -E 
checking for a sed that does not truncate output... /bin/sed 
expr: syntax error 
sh: 0: unknown operand 
expr: syntax error 
sh: 0: unknown operand 
checking for cc... cc 
checking whether the C compiler works... yes 
checking for C compiler default output file name... a.out 
checking for suffix of executables... 
checking whether we are cross compiling... no 
checking for suffix of object files... o 
checking whether we are using the GNU C compiler... yes 
checking whether cc accepts -g... yes 
checking for cc option to accept ISO C89... none needed 
checking how to run the C preprocessor... cc -E 
checking for icc... no 
checking for suncc... no 
checking whether cc understands -c and -o together... yes 
checking for system library directory... lib 
checking if compiler supports -R... no 
checking if compiler supports -Wl,-rpath,... yes 
checking build system type... x86_64-unknown-linux-gnu 
checking host system type... x86_64-unknown-linux-gnu 
checking target system type... x86_64-unknown-linux-gnu 
checking for PHP prefix... /usr/local 
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib 
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20151012 
checking for PHP installed headers prefix... /usr/local/include/php 
checking if debug is enabled... no 
checking if zts is enabled... no 
checking for re2c... no 
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. 
checking for gawk... no 
checking for nawk... no 
checking for awk... awk 
checking if awk is broken... no 
checking whether to enable mongodb support... yes, shared 
checking OpenSSL dir for mongodb... yes 
checking whether to use system default cipher list instead of hardcoded value... no 
checking PHP version... 70022 
/tmp/pear/temp/mongodb/configure: ./configure.lineno: line 1: syntax error: unterminated quoted string 
ERROR: `/tmp/pear/temp/mongodb/configure --with-php-config=/usr/local/bin/php-config' failed 
Removing intermediate container 288e5589f2ca 

Lequel comme vous pouvez le voir, je reçois ce qui suit erreur:

/tmp/pear/temp/mongodb/configure: ./configure.lineno: line 1: syntax error: unterminated quoted string 

Alors, vous avez une idée comment résoudre ce problème?

+1

Ceci est un bug nouvellement introduit, il y a un billet ouvert pour elle: https: // JIRA. mongodb.org/browse/PHPC-1014 – olvlvl

Répondre

2

Votre problème est que celui qui a écrit le script pecl pour mongodb l'a testé sur bash et non sur sh. Donc le script n'est pas compatible avec sh. La solution est simple, lancez-le par bash

FROM php:7.0-fpm-alpine 
MAINTAINER John Doe <[email protected]> 

RUN apk update &&\ 
    apk add --update --virtual build_deps bash gcc g++ autoconf make openssl-dev pcre-dev &&\ 
    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/* 

également pour apk del il vous suffit de donner les paquets virtuels nommer