thecodingmachine / docker-images-php

A set of PHP Docker images
MIT License
768 stars 137 forks source link

Adding extensions in Dockerfile to slim image: The following extension(s) is not supported: redis #343

Closed beejaz closed 1 year ago

beejaz commented 1 year ago

Expected Behavior

redis extension is added to thecodingmachine/php:8.1-v4-slim-fpm image in Dockerbuild process when using ARG PHP_EXTENSIONS in Dockerfile as described here https://github.com/thecodingmachine/docker-images-php#compiling-extensions-in-the-slim-image

Current Behavior

Error message at end of build thecodingmachine/php:8.1-v4-slim-fpm:

#5 9.432 Reading package lists...
#5 10.17 + /usr/bin/real_php /usr/local/bin/install_selected_extensions.php
#5 10.29 *** Installing extensions ***
#5 10.29 The following extension(s) is not supported: redis
#5 10.29 Supported extensions: bcmath, bz2, dba, enchant, gd, gmp, imap, intl, ldap, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, pspell, snmp, soap, sqlite3, tidy, zip
------
executor failed running [/bin/sh -c sudo -E PHP_EXTENSIONS="$PHP_EXTENSIONS" /usr/local/bin/install_selected_extensions.sh]: exit code: 1

If i instead run with the image thecodingmachine/php:8.1-v4-slim-apache, the output is successfull as expected:

=> [internal] load metadata for docker.io/thecodingmachine/php:8.1-v4-slim-apache                                                                                                           0.0s
 => [1/1] FROM docker.io/thecodingmachine/php:8.1-v4-slim-apache                                                                                                                             1.2s
 => [2/1] RUN sudo -E PHP_EXTENSIONS="pdo_mysql intl ldap redis" /usr/local/bin/install_selected_extensions.sh                                                                              42.7s
 => [3/1] RUN if [ -n "$INSTALL_CRON" ]; then      SUPERCRONIC="supercronic-linux-amd64"      && SUPERCRONIC_URL="https://github.com/aptible/supercronic/releases/download/v0.1.9/${SUPERCR  0.4s
 => [4/1] RUN if [ -n "$NODE_VERSION" ]; then     sudo apt-get update &&     sudo apt-get install -y --no-install-recommends gnupg &&     curl -sL https://deb.nodesource.com/setup_${NODE_  0.4s 
 => exporting to image                                                                                                                                                                       0.5s 
 => => exporting layers                                                                                                                                                                      0.4s 
 => => writing image sha256:096a8bc95351c46bcdb524c821f9868541fa19e475f46f962b7ebd6674461e0f                                                                                                 0.0s 

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them

Possible Solution

Steps to Reproduce (for bugs)

Dockerfile

ARG PHP_EXTENSIONS="pdo_mysql intl ldap redis"
FROM thecodingmachine/php:8.1-v4-slim-fpm

docker build .

Context

Im trying to include redis extension in slim image (php:8.1-v4-slim-fpm)

Your Environment

beejaz commented 1 year ago

For some reason, it worked when I forced it, maybe I had some old version in cache ?

docker-compose build app --no-cache --pull

Im closing this.