Usr local etc php conf d docker php ext sodium ini

I use docker-compose and have a number of containers in one project: Nginx, PHP, Composer and nginx. All works well except for one thing: composer does not work. I am trying to install a composer project that uses the GD extension, which is installed in PHP (confirmed using php -m inside the PHP container). However, the composer container does not "see" this extension and complaints it does not exist. How can I link those two?

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/ \

Error:

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

Hi! All PHP images contain a lot of extensions, including sodium.

But these extensions are disabled by default, and we enable them only if PHP_EXTENSIONS contains some of them

For example, the template has sodium extension: //github.com/magento/magento-cloud/blob/2.4.3/.magento.app.yaml#L18 When you run ./vendor/bin/ece-docker build:compose this command reads .magento.app.yaml and generates the correct docker-compose.yaml file with sodium

Hello @BaDos ,

It doesn't really make sense to disable sodium by default, as the image is meant to be used for many commands, not only as a docker-compose service.

For example, in the official documentation, at the Run Composer with Docker, it is suggested to use the following command to run composer:

docker run -it -v $(pwd):/app/:delegated -v ~/.composer/:/root/.composer/:delegated magento/magento-cloud-docker-php:7.3-cli-1.1 bash -c "composer install&&chown www. /app/"

but this wouldn't use a docker-compose file, thus it won't read any "PHP_EXTENSIONS" line from it.

Since libsodium is a required extension for Magento, it should be (in my opinion) enabled by default in all of Magento Cloud Docker PHP images

Chủ đề