Добрый день,
Есть docker-compose.yml:
...
php-fpm:
build:docker/containers/php-fpm
volumes:
- ./.:/var/www
- ./volumes/php-fpm/php7.1-fpm.ini:/usr/local/etc/php/php.ini
...
./docker/containers/php-fpm/Dockerfile:
FROM php:7.1-fpm-alpine
RUN apk --update --virtual build-deps add \
autoconf \
make \
gcc \
g++ \
libtool \
icu-dev \
curl-dev \
freetype-dev \
imagemagick-dev \
pcre-dev \
postgresql-dev \
libmcrypt-dev \
libjpeg-turbo-dev \
libpng-dev \
libxml2-dev && \
apk add \
git \
curl \
bash \
bash-completion \
icu \
imagemagick \
pcre \
freetype \
libmcrypt \
libintl \
libjpeg-turbo \
libpng \
libltdl \
libxml2 \
mysql-client \
nodejs-npm \
postgresql && \
pecl install \
apcu \
imagick \
mcrypt-1.0.0 && \
docker-php-ext-configure gd \
--with-gd \
--with-freetype-dir=/usr/include/ \
--with-png-dir=/usr/include/ \
--with-jpeg-dir=/usr/include/ && \
docker-php-ext-configure bcmath && \
docker-php-ext-install \
soap \
zip \
curl \
bcmath \
exif \
gd \
iconv \
intl \
mbstring \
opcache \
pdo_mysql \
pdo_pgsql && \
apk del \
build-deps
ARG phpIniPath=/usr/local/etc/php/php.ini
RUN sed -ri -e 's/^allow_url_fopen\s*=.*/allow_url_fopen = On/' $phpIniPath
RUN sed -i -e 's/^allow_url_fopen\s*=.*/allow_url_fopen = On/' $phpIniPath
RUN sed -i -e 's/^short_open_tag\s*=.*/short_open_tag = On/' $phpIniPath
RUN sed -i -e 's/^;extension=php_curl.dll\s*=.*/extension=php_curl.dll/' $phpIniPath
RUN echo 'extension = mcrypt.so' >> $phpIniPath
WORKDIR /var/www
При попытке:
sudo docker-compose up --build -d
Ловлю:
...
Step 8/9 : RUN sed -ri -e 's/^allow_url_fopen\s*=.*/allow_url_fopen = On/' $phpIniPath
---> Running in 84504b5e4c25
sed: /usr/local/etc/php/php.ini: No such file or directory
ERROR: Service 'php-fpm' failed to build: The command '/bin/sh -c sed -ri -e 's/^allow_url_fopen\s*=.*/allow_url_fopen = On/' $phpIniPath' returned a non-zero code: 1
Пробовал еще варианты со своим файлом, лежащим рядом с докер файлом:
1) ADD php.ini /usr/local/etc/php/
1) COPY php.ini /usr/local/etc/php/
Ловлю:
...
ERROR: for php-fpm Cannot start service php-fpm: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/home/andrey/Public/www/docker/kpr-docker/volumes/php-fpm/php7.1-fpm.ini\\\" to rootfs \\\"/var/lib/docker/overlay2/d4bb8e3f1beb99584eb72c23021b6734cdcc5a3741c1e3328c6cf35efa40a8f5/merged\\\" at \\\"/var/lib/docker/overlay2/d4bb8e3f1beb99584eb72c23021b6734cdcc5a3741c1e3328c6cf35efa40a8f5/merged/usr/local/etc/php/php.ini\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.
Подскажите на каком моменте можно получить файл
/usr/local/etc/php/php.ini в контейнере?