无法构建Dockerfile - 无法找到包

时间:2018-06-08 09:04:19

标签: php linux docker vmware-workstation debian-jessie

我正在接受培训,我被要求安装开发环境,问题是它不起作用。然而对于其他人来说一切都很好

说明很简单:

  • 在我的Windows上安装虚拟机(debian jessie with vmware)
  • 在vm上拉项目
  • 做一个docker-compose build

问题在于,当我构建(docker-compose build)时,它告诉我:

    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"]

2 个答案:

答案 0 :(得分:0)

当建造码头工人对你说,他找不到包裹npm。 尝试以另一种方式安装这些数据包。

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

sudo apt-get install -y nodejs

和其他数据包

答案 1 :(得分:0)

问题解决了:这是因为php:5.6-apache现在链接到php:5.6-apache-stretch而不是php:5.6-apache-jessie。