Search code examples
phplinuxdockervmware-workstationdebian-jessie

Failed to build Dockerfile - unable to locate package


I'm in training and I'm asked to install the dev environment the problem is that it does not work. Yet for others everything is good

the instructions are simple:

  • install a VM on my windows (debian jessie with vmware)
  • pull the project on the vm
  • do a docker-compose build

the problem is that when I build (docker-compose build) it tells me:

    Building backend
Step 1/27 : FROM php:5.6-apache
 ---> a7188ff4c552
Step 2/27 : RUN rm /etc/apt/preferences.d/no-debian-php
 ---> Using cache
 ---> 5e10fb8a2d21
Step 3/27 : RUN apt-get update && apt-get install -y bash alien libaio1 git zlib1g-dev libxml2-dev nodejs-legacy npm libfontconfig libicu-dev g++ libpcre3-dev pdftk php5-apcu
 ---> Running in 04d17961b6f2
Get:1 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Get:2 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [442 kB]
Ign:3 http://cdn-fastly.deb.debian.org/debian stretch InRelease
Get:4 http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:5 http://cdn-fastly.deb.debian.org/debian stretch Release [118 kB]
Get:6 http://cdn-fastly.deb.debian.org/debian stretch-updates/main amd64 Packages [12.1 kB]
Get:7 http://cdn-fastly.deb.debian.org/debian stretch Release.gpg [2434 B]
Get:8 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 Packages [9530 kB]
Fetched 10.3 MB in 2s (4115 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package npm
E: Unable to locate package php5-apcu
ERROR: Service 'backend' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y bash alien libaio1 git zlib1g-dev libxml2-dev nodejs-legacy npm libfontconfig libicu-dev g++ libpcre3-dev pdftk php5-apcu' returned a non-zero code: 100

Dockerfile:

FROM php:5.6-apache

RUN rm /etc/apt/preferences.d/no-debian-php

# Dependencies
RUN apt-get update && apt-get install -y bash alien libaio1 git zlib1g-dev libxml2-dev nodejs-legacy npm libfontconfig libicu-dev g++ libpcre3-dev pdftk php5-apcu
#RUN npm install -g phantomjs@1.9.8
RUN npm install -g phantomjs

ENV ORACLE_HOME /usr/lib/oracle/11.2/client64/
ENV C_INCLUDE_PATH /usr/include/oracle/11.2/client64/

# Installation Instant client
WORKDIR /root
COPY ./libs/oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm /root/oracle-instantclient11.2-basic.rpm
COPY ./libs/oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm  /root/oracle-instantclient11.2-devel.rpm
RUN alien -d oracle-instantclient11.2-basic.rpm \
    && alien -d oracle-instantclient11.2-devel.rpm \
    && rm -f oracle-instantclient11.2-*.rpm \
    && dpkg -i oracle-instantclient11.2-basic_*.deb \
    && dpkg -i oracle-instantclient11.2-devel_*.deb \
    && rm -f oracle-instantclient11.2-*.deb

# Install pecl oci8 extension
RUN if [ ! "$http_proxy" = "" ]; then pear config-set http_proxy $http_proxy; fi
RUN pecl channel-update pecl.php.net \
    && pecl download oci8-2.0.10 && tar xzf oci8-*.tgz && rm oci8-*.tgz && cd oci8-* \
    && phpize && ./configure && make && make install \
    && echo "extension=oci8.so" >> /usr/local/etc/php/conf.d/oci8.ini \
    && cd .. && rm -Rf oci8-*

# pour ext ldap
RUN apt-get install -y php5-ldap \
    && ln -s /etc/php5/mods-available/ldap.ini /usr/local/etc/php/conf.d/ \
    && ln -s /etc/php5/mods-available/apcu.ini /usr/local/etc/php/conf.d/ \
    && ln -s /usr/lib/php5/20131226/ldap.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/ \
    && ln -s /usr/lib/php5/20131226/apcu.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226

# Install Arial Font
RUN sed -i s/main/main\ contrib/g /etc/apt/sources.list
RUN apt-get update && apt-get install -y ttf-mscorefonts-installer

# Install PHP additional dependencies
RUN docker-php-ext-install -j$(nproc) zip soap intl opcache

# Install Symfony and composer CLI
RUN curl -LsS --insecure https://symfony.com/installer -o /usr/local/bin/symfony \
    && curl -LsS --insecure https://getcomposer.org/composer.phar -o /usr/local/bin/composer
RUN chmod a+x /usr/local/bin/symfony /usr/local/bin/composer

# Enable extra Apache mods
RUN a2enmod rewrite vhost_alias headers expires

# Install custom conf
COPY ./configs/vhost.conf /etc/apache2/sites-enabled/vhost.conf
COPY ./configs/php.ini /usr/local/etc/php/php.ini
COPY ./configs/php-cli.ini /usr/local/etc/php/php-cli.ini
RUN rm -f /etc/apache2/sites-enabled/000-default.conf

# Change working directory in order to run all Symfony commands from application root directory
WORKDIR /var/www/app

COPY ./bin/run.sh /usr/local/bin/run-container
RUN chmod a+x /usr/local/bin/run-container
CMD ["run-container"]

Solution

  • Problem solved : It was because php:5.6-apache is now link to php:5.6-apache-stretch and not php:5.6-apache-jessie.