Docker Community Forums

Share and learn in the Docker community.

pecl removed from container after the use of docker-php-ext-install

docker
build

#1

In summary, my problem is that the contents of the folder /usr/local/lib/php/ is removed after using the command docker-php-ext-install

I’ve created a Docker file that was building successfully in my computer, the problem started when my fellow developer cloned my repository and he got an error: Could not open input file: /usr/local/lib/php/peclcmd.php when trying to execute the command yes '' | pecl install mcrypt-1.0.1 I’ve debugged the problem and the folder contents of /usr/local/lib/php/ is:

Archive build Console data doc extensions OS PEAR pearcmd.php PEAR.php peclcmd.php Structures System.php test XML

After the first command with docker-php-ext-install the only folder left is extensions

This is the Dockerfile:

FROM quay.io/alexcheng1982/apache2-php7:7.2.12

ENV MAGENTO_VERSION 2.3.0
ENV INSTALL_DIR /var/www/html
ENV COMPOSER_HOME /var/www/.composer/

RUN curl -sS https://getcomposer.org/installer | php \
    && mv composer.phar /usr/local/bin/composer \
    && composer global require hirak/prestissimo
COPY ./auth.json $COMPOSER_HOME

RUN requirements="libpng12-dev libmcrypt-dev libmcrypt4 libcurl3-dev libfreetype6 libjpeg-turbo8 libjpeg-turbo8-dev libpng12-dev libfreetype6-dev libicu-dev libxslt1-dev unzip" \
    && apt-get update \
    && apt-get install -y $requirements \
    && rm -rf /var/lib/apt/lists/* \
    && docker-php-ext-install pdo_mysql \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install gd \
    && docker-php-ext-install mbstring \
    && docker-php-ext-install zip \
    && docker-php-ext-install intl \
    && docker-php-ext-install xsl \
    && docker-php-ext-install soap \
    && docker-php-ext-install bcmath \
    && requirementsToRemove="libpng12-dev libmcrypt-dev libcurl3-dev libpng12-dev libfreetype6-dev libjpeg-turbo8-dev" \
    && apt-get purge --auto-remove -y $requirementsToRemove

RUN apt-get update \
    && apt-get install -y libmcrypt-dev \
    && yes '' | pecl install mcrypt-1.0.1 \
    && echo 'extension=mcrypt.so' > /usr/local/etc/php/conf.d/mcrypt.ini

Docker version 18.09.1, docker-compose version 1.22.0