问题描述
步骤13/25:添加PHP.ini /usr/local/etc/PHP/PHP.ini
错误:服务'PHPt3'生成失败:添加失败:统计 /var/lib/docker/tmp/docker-builder310748204/PHP.ini:否 这样的文件或目录
以下是docker文件:
FROM PHP:7.3-fpm
# install the PHP extensions we need
RUN apt-get update \
&& apt-get install -y --no-install-recommends msmtp mailutils vim curl debconf subversion git apt-transport-https apt-utils \
build-essential locales acl mailutils wget nodejs \
gnupg gnupg1 gnupg2 \
zlib1g-dev zlib1g-dev libicu-dev g++ \
sudo
# Install GD
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev
RUN docker-PHP-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-PHP-ext-install -j$(nproc) gd
RUN docker-PHP-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-PHP-ext-install gd
# MysqLI
RUN docker-PHP-ext-install MysqLi && docker-PHP-ext-enable MysqLi
# Install ext-zip
RUN apt-get install -y unzip libzip-dev
RUN docker-PHP-ext-install zip
RUN docker-PHP-ext-configure intl
RUN docker-PHP-ext-install pdo_MysqL json calendar intl
ADD PHP.ini /usr/local/etc/PHP/PHP.ini
copY additionnal.ini /usr/local/etc/PHP/conf.d/
copY PHP-fpm-pool.conf /usr/local/etc/PHP/pool.d/www.conf
RUN rm -rf /var/lib/apt/lists/* \
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
echo "fr_FR.UTF-8 UTF-8" >> /etc/locale.gen && \
locale-gen
# Install Composer
RUN curl -sS https://getcomposer.org/installer | PHP -- --install-dir=/usr/local/bin --filename=composer
RUN composer --version
# set up sendmail config,see http://linux.die.net/man/5/ssmtp.conf for options
RUN echo "hostname=localhost.localdomain" > /etc/msmtp/msmtp.conf
RUN echo "mailhub=maildevt3" >> /etc/msmtp/msmtp.conf
# The above 'maildevt3' is the name you used for the link command
# in your docker-compose file or docker link command.
# Docker automatically adds that name in the hosts file
# of the container you're linking MailDev to.
# Set up PHP sendmail config
RUN echo "sendmail_path=sendmail -i -t" >> /usr/local/etc/PHP/conf.d/PHP-sendmail.ini
# Fully qualified domain name configuration for sendmail on localhost.
# Without this sendmail will not work.
# This must match the value for 'hostname' field that you set in ssmtp.conf.
RUN echo "localhost localhost.localdomain" >> /etc/hosts
workdir /var/www/
EXPOSE 9000
CMD ["PHP-fpm"]
任何人都可以帮助我克服此错误。
我正在做本教程 https://passions.miary.dev/2019/08/30/docker-maildev-fr/
解决方法
图像安装程序似乎无权写入安装目录。
->如何解决:
- ADD failed : No such file/Directory while building docker image
- 如果这样不起作用:请检查错误中显示的文件夹是否存在。
- 使用
chmod
-> https://wiki.ubuntuusers.de/chmod/ 授予目录足够的权限