簡體   English   中英

在運行 docker 構建時,它無法讀取 /etc/php/7.2/apache2/php.ini:沒有這樣的文件或目錄

[英]While running docker build it can't read /etc/php/7.2/apache2/php.ini: No such file or directory

當我構建 docker 文件時,我收到can't read /etc/php/7.2/apache2/php.ini: No such file or directory ,但在本地路徑文件中可用。

我需要知道如何授予對本地可用文件的訪問權限。

沒有這樣的文件或目錄錯誤圖像

我的 DOCKERfile

FROM ubuntu:16.04
MAINTAINER Sreekanth G S <mail@sreekanth.in>
#ENV http_proxy=http://sysfp0t.its.unc.edu:80
#ENV https_proxy=http://sysfp0t.its.unc.edu:80
#RUN DEBIAN_FRONTEND=noninteractive \
#    apt-get -o Acquire::http::Proxy="http://sysfp0t.its.unc.edu:80"  update && \
#    apt-get -o Acquire::http::Proxy="http://sysfp0t.its.unc.edu:80" install -y language-pack-en-base &&\
#    export LC_ALL=en_US.UTF-8 && \
#`    export LANG=en_US.UTF-8


RUN DEBIAN_FRONTEND=noninteractive apt-get update   && apt-get install -y  software-properties-common
#RUN cat /etc/locale.gen
#RUN cat /etc/environment
#RUN LANG=en_US.UTF-8 locale-gen --purge en_US.UTF-8 &&  echo -e 'LANG="en_US.UTF-8"\nLANGUAGE="en_US:en"\n' > /etc/default/locale && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen &&  echo "LC_ALL=en_US.UTF-8" > /etc/environment &&  echo "LANG=en_US.UTF-8" >> /etc/environment &&  locale-gen "en_US.UTF-8"  && export LC_ALL=en_US.UTF-8 && export LANG=en_US.UTF-8 &&  add-apt-repository ppa:ondrej/php

#RUN apt-get -o Acquire::http::Proxy="http://sysfp0t.its.unc.edu:80"  update && apt-get -o Acquire::http::Proxy="http://sysfp0t.its.unc.edu:80" install -y software-properties-common language-pack-en-base && \
#LC_ALL=C.UTF-8  add-apt-repository  ppa:ondrej/php && apt-get -o Acquire::http::Proxy="http://sysfp0t.its.unc.edu:80" update && apt-get -o Acquire::http::Proxy="http://sysfp0t.its.unc.edu:80" install -y \
RUN echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu xenial main" >> /etc/apt/sources.list && echo "deb-src http://ppa.launchpad.net/ondrej/php/ubuntu xenial main" >> /etc/apt/sourceis.list && apt-get update --allow-unauthenticated
RUN cat /etc/apt/sources.list && ls -l /etc/apt/
RUN apt-get  install -y --allow-unauthenticated apache2-bin libapache2-mod-php php-curl php-ldap php-mysql php-mcrypt \
php-gd php-xml patch curl vim git mysql-client wget unzip

RUN phpenmod mcrypt && phpenmod gd
RUN a2enmod xml2enc && a2enmod rewrite

RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/7.2/apache2/php.ini
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/7.2/cli/php.ini

RUN useradd --uid 1000 --gid 50 docker

RUN echo export APACHE_RUN_USER=docker >> /etc/apache2/envvars
RUN echo export APACHE_RUN_GROUP=staff >> /etc/apache2/envvars

COPY 000-default.conf /etc/apache2/sites-enabled/000-default.conf

RUN chown -R docker /var/www/html

WORKDIR /var/www/html

RUN wget -q "http://www.sentrifugo.com/home/downloadfile?file_name=Sentrifugo.zip" -O Sentrifugo.zip 
#COPY Sentrifugo.zip /var/www/html/
RUN unzip Sentrifugo.zip && mv Sentrifugo_3.2 sentrifugo

WORKDIR /var/www/html/sentrifugo
RUN chown -R docker .

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

RUN chmod 777 -R public/downloads public/uploads public/email_constants.php \
public/emptabconfigure.php \
public/site_constants.php \
public/db_constants.php \
public/application_constants.php \
public/mail_settings_constants.php \
logs/application.log \
application/modules/default/plugins/AccessControl.php \
install

VOLUME /var/www/html/sentrifugo/public/uploads

VOLUME /var/www/html/sentrifugo/public/downloads

ENTRYPOINT ["/entrypoint.sh"]

EXPOSE 80

docker-compose.yml 文件

    version: '3'
services:
  sentrifugo:
    build:
      context: .
      dockerfile: Dockerfile-sentrifugo
    container_name: sentrifugo
    ports:
      - "8080:80"
      - "8443:443"
    devices:
      - "/dev/tty:/dev/tty"
    links:
      - "mariadb:mariadb"
  mariadb:
    build:
      context: .
      dockerfile: Dockerfile-mariadb
    container_name: mariadb
    ports:
     - "3306:3306"

Dockerfile-mariadb

from mariadb:latest

ENV MYSQL_RANDOM_ROOT_PASSWORD=true
ENV MYSQL_DATABASE=sentrifugo
ENV MYSQL_USER=sentrifugo
ENV MYSQL_PASSWORD=54y6RxN7GfC7aes3
EXPOSE 3306

我的本地文件夾圖像我的本地驅動器路徑和文件詳細信息

構建腳本的命令

docker-compose up -d

Z469A31FD9D773110F14057BAECCDDD25Z 文件

    FROM ubuntu:trusty
MAINTAINER Oleksandr Simonov <asimonov@gmail.com>

RUN apt-get update && apt-get install -y \
apache2-bin \
libapache2-mod-php5 \
php5-curl \
php5-ldap \
php5-mysql \
php5-mcrypt \
php5-gd \
patch \
curl \
vim \
git \
mysql-client

RUN php5enmod mcrypt
RUN php5enmod gd
RUN a2enmod rewrite

RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php5/apache2/php.ini
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php5/cli/php.ini

RUN useradd --uid 1000 --gid 50 docker

RUN echo export APACHE_RUN_USER=docker >> /etc/apache2/envvars
RUN echo export APACHE_RUN_GROUP=staff >> /etc/apache2/envvars

COPY 000-default.conf /etc/apache2/sites-enabled/000-default.conf

COPY . /var/www/html
RUN chown -R docker /var/www/html

WORKDIR /var/www/html

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]

EXPOSE 80

它對我有用,錯誤已解決。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM