Я использую docker-compose и у меня есть несколько контейнеров в одном проекте: Nginx, PHP, Composer и nginx.Все работает хорошо, за исключением одного: композитор не работает.Я пытаюсь установить проект композитора, который использует расширение GD, которое устанавливается в PHP (подтверждено с помощью php -m внутри контейнера PHP).Однако контейнер композитора не «видит» это расширение и жалуется, что его не существует.Как я могу связать эти два?
docker-compose.yml:
version: '2'
services:
web:
image: nginx:1.15.1
volumes:
- ./.docker/conf/nginx/default.conf:/etc/nginx/conf.d/default.conf
- ./html:/var/www/html
ports:
- 8888:80
depends_on:
- php
- db
php:
build: .docker
volumes:
- ./.docker/conf/php/php.ini:/usr/local/etc/php/conf.d/php.ini
- ./.docker/conf/php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini
- ./html:/var/www/html
composer:
image: composer
volumes:
- ./html:/app
command: install
depends_on:
- php
db:
image: postgres:10.4
environment:
- POSTGRES_DB=test
- POSTGRES_USER=test
- POSTGRES_PASSWORD=test
ports:
- 5432:5432
volumes:
- ./.docker/conf/postgres/:/docker-entrypoint-initdb.d/
adminer:
image: adminer
ports:
- 8080:8080
Dockerfile:
FROM php:7.2-fpm
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
libicu-dev \
libpq-dev \
libxpm-dev \
libvpx-dev \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& docker-php-ext-install -j$(nproc) gd \
&& docker-php-ext-install -j$(nproc) intl \
&& docker-php-ext-install -j$(nproc) zip \
&& docker-php-ext-install -j$(nproc) pgsql \
&& docker-php-ext-install -j$(nproc) pdo_pgsql \
&& docker-php-ext-install -j$(nproc) exif \
&& docker-php-ext-configure gd \
--with-freetype-dir=/usr/include/ \
--with-jpeg-dir=/usr/include/ \
--with-xpm-dir=/usr/lib/x86_64-linux-gnu/ \
--with-vpx-dir=/usr/lib/x86_64-linux-gnu/ \
Ошибка:
Starting test_app_db_1 ... done
Starting test_app_php_1 ... done
Starting test_app_adminer_1 ... done
Recreating test_app_composer_1 ... done
Starting test_app_web_1 ... done
Attaching to test_app_adminer_1, test_app_php_1, test_app_db_1, test_app_web_1, test_app_composer_1
php_1 | [12-Oct-2018 21:26:47] NOTICE: fpm is running, pid 1
php_1 | [12-Oct-2018 21:26:47] NOTICE: ready to handle connections
adminer_1 | PHP 7.2.1 Development Server started at Fri Oct 12 21:26:47 2018
db_1 | 2018-10-12 21:26:47.716 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2018-10-12 21:26:47.716 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2018-10-12 21:26:47.736 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2018-10-12 21:26:47.827 UTC [21] LOG: database system was shut down at 2018-10-12 21:11:42 UTC
db_1 | 2018-10-12 21:26:47.845 UTC [1] LOG: database system is ready to accept connections
composer_1 | Loading composer repositories with package information
composer_1 | Updating dependencies (including require-dev)
composer_1 | Your requirements could not be resolved to an installable set of packages.
composer_1 |
composer_1 | Problem 1
composer_1 | - gumlet/php-image-resize 1.9.1 requires ext-gd * -> the requested PHP extension gd is missing from your system.
composer_1 | - gumlet/php-image-resize 1.9.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
composer_1 | - Installation request for gumlet/php-image-resize 1.9.* -> satisfiable by gumlet/php-image-resize[1.9.0, 1.9.1].
composer_1 |
composer_1 | To enable extensions, verify that they are enabled in your .ini files:
composer_1 | -
composer_1 | - /usr/local/etc/php/conf.d/date_timezone.ini
composer_1 | - /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
composer_1 | - /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
composer_1 | - /usr/local/etc/php/conf.d/memory-limit.ini
composer_1 | You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
test_app_composer_1 exited with code 2