php - 无法构建 Dockerfile - 无法找到包

标签 php linux docker vmware-workstation debian-jessie

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

说明很简单:

  • 在我的 Windows 上安装虚拟机(带有 vmware 的 debian jessie)
  • 在虚拟机上拉取项目
  • 进行 docker-compose 构建

问题是当我构建(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 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="90e0f8f1fee4fffdfae3d0a1bea9bea8" rel="noreferrer noopener nofollow">[email protected]</a>
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"]

最佳答案

当构建 docker 时,他会告诉你他找不到 npm 包。 尝试以其他方式安装这些数据包。

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

sudo apt-get install -y nodejs

以及其他数据包

关于php - 无法构建 Dockerfile - 无法找到包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50757048/

相关文章:

linux - 在 makefile 上运行 make run 2 次

bash - 在 docker 容器中的主要服务完全加载后运行 bash 脚本

php.ini 默认时区与 date.timezone

php - 为什么这么多 MVC Web 框架喜欢将多个 Controller 操作分组到一个类中?

php - 组合两个数组值,使它们成为 key=>value 格式

linux - 根据CSV输入选择并压缩文件

Php Mailer 给出错误系统空间不足(错误代码 :4. 3.1)

linux - Docker 持续部署工作流程

docker - 在centos中更改docker根路径

PHP pdo : prepare() vs transactions