简体   繁体   English

无法建立Dockerfile-无法找到套件

[英]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) 在我的Windows上安装VM(使用vmware的Debian jessie)
  • pull the project on the vm 在虚拟机上拉项目
  • do a docker-compose build 做一个docker-compose构建

the problem is that when I build (docker-compose build) it tells me: 问题是当我构建(docker-compose构建)时,它告诉我:

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

When building docker says to you than he can not find package npm. 在构建docker时,您无法找到npm软件包。 Try to install these packets another way. 尝试以其他方式安装这些数据包。

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

sudo apt-get install -y nodejs

And other packets 等包

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM