Docker | Build getting exiting on Interactive Shell - php

I am trying to run a version of Swoole with php7.3-alpine image.
When running, everything builds correctly and all of the extensions get installed correctly. However, when it comes to doing docker-compose up I get stuck in Interactive shell and then exits with code 0 so the container doesn't actually boot up correctly.
Is there anything I can do to stop this issue and stop it from running the interactive shell?
FROM composer:latest as builder
WORKDIR /app
RUN composer global require hirak/prestissimo
COPY . /app/
RUN composer install \
--no-ansi \
--no-dev \
--no-interaction \
--no-progress \
--optimize-autoloader \
--ignore-platform-reqs
RUN rm -rf docker/ composer.json composer.lock && \
touch /app/storage/logs/lumen.log
FROM php:7.3-alpine
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 \
PHP_OPCACHE_MAX_ACCELERATED_FILES=7963 \
PHP_OPCACHE_MEMORY_CONSUMPTION=192
RUN set -ex \
&& apk update \
&& apk add --no-cache libffi-dev icu libsodium \
&& apk add --no-cache --virtual build-dependencies icu-dev g++ make autoconf libsodium-dev \
&& docker-php-source extract \
&& pecl install swoole redis sodium \
&& docker-php-ext-enable redis swoole sodium \
&& docker-php-source delete \
&& docker-php-ext-install -j$(nproc) pdo_mysql intl \
&& cd / && rm -fr /src \
&& apk del build-dependencies \
&& rm -rf /tmp/*
COPY --from=builder --chown=www-data:www-data /app /var/www
COPY docker/php.ini /usr/local/etc/php/php.ini
USER www-data
WORKDIR /var/www
EXPOSE 1215
docker-compose.yml
web:
build:
context: .
dockerfile: docker/Dockerfile
ports:
- "80:1215"
env_file:
- .env
output
web_1 | Interactive shell
web_1 |
web_1 exited with code 0

You need to define a CMD at the end of your dockerfile the last stage which will be used as a starting point for the container that you will run it. you can check the following URL
The Interactive Shell is there because of the original CMD of php:7.3-alpine which is php -a that gives:
Interactive shell
php >
You need to define your own CMD that starts your application and check the logs if it was not working

Related

Unable to install ext-mysqli in official php docker image [duplicate]

In order to resolve an issue, I am now trying install the mysql pdo via
docker-php-ext-install
as pointed out in the README of the php image.
Yet my call fails stating:
Libraries have been installed in:
/usr/src/php/ext/mysqli/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20131226/
Installing header files: /usr/local/include/php/
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la modules/* libs/*
+ cd /usr/src/php/ext/mysqlnd
+ phpize
Cannot find config.m4.
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module
ERROR: Service 'phlaconapp' failed to build: The command '/bin/sh -c docker-php-ext-install mysqli mysqlnd pdo pdo_mysql zip' returned a non-zero code: 1
This is my docker-compose.yml:
phlaconapp:
hostname: phaclonapp
dockerfile: Dockerfile
build: ./
ports:
- "1080:80"
- "1043:433"
environment:
TERM: xterm-color
ENVIRONMENT: dev
volumes:
- ./:/var/www/html/
links:
- mysql
mysql:
image: mysql:5.6
volumes:
- ./docker/mysql.d:/etc/mysql/conf.d
ports: ["3306:3306"]
environment:
MYSQL_ROOT_PASSWORD: 'root'
This is my Dockerfile:
FROM php:5.6-apache
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php -r "if (hash_file('SHA384', 'composer-setup.php') === '070854512ef404f16bac87071a6db9fd9721da1684cd4589b1196c3faf71b9a2682e2311b36a5079825e155ac7ce150d') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
php composer-setup.php && \
php -r "unlink('composer-setup.php');"
RUN apt-get update && \
apt-get install vim git -y
RUN docker-php-ext-install mysqli mysqlnd pdo pdo_mysql zip
RUN cd / && \
git clone --depth=1 git://github.com/phalcon/cphalcon.git && \
cd cphalcon/build && \
./install
RUN echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/phalcon.ini
RUN a2enmod rewrite
and running docker-compose build won't finish.
I had the same problem a while ago. I started a container and typed the ext-install command into this container. Once I found all the dependencies, I wrote them into the Dockerfile.
Example:
RUN apt-get update && apt-get install -y \
libmcrypt-dev \
&& docker-php-ext-install -j$(nproc) mcrypt
There is a dependency that libmcrypt-dev needed before you can run docker-php-ext-install mcrypt
I've checked my older Dockerfiles and found something which might help you
FROM php:5.6-apache
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
libicu-dev \
libxml2-dev \
vim \
wget \
unzip \
git \
&& docker-php-ext-install -j$(nproc) iconv intl xml soap mcrypt opcache pdo pdo_mysql mysqli mbstring \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd
RUN a2enmod rewrite && mkdir /composer-setup && wget https://getcomposer.org/installer -P /composer-setup && php /composer-setup/installer --install-dir=/usr/bin && rm -Rf /composer-setup && curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony && chmod a+x /usr/local/bin/symfony
# Create symlink for default conf
RUN ln -s /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-enabled/000-default.conf && mkdir /composer-setup && wget https://getcomposer.org/installer -P /composer-setup && php /composer-setup/installer --install-dir=/usr/bin && rm -Rf /composer-setup && curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony && chmod a+x /usr/local/bin/symfony
RUN docker-php-ext-install mbstring pdo pdo_mysql \
That code can do install any extension you want in this case mysql pdp driver but the Dockerfile should have base of FROM php:7.1.8-apache
The 2019 way and probably the 2020 way of installing memcached to your Docker PHP container is the way described on https://hub.docker.com/_/php
FROM php:latest
RUN pecl install memcached \
&& docker-php-ext-enable memcached
FROM php:5.6-cli
RUN apt-get update && apt-get install -y libmemcached-dev zlib1g-dev \
&& pecl install memcached-2.2.0 \
&& docker-php-ext-enable memcached
Seems to be a bug in phpize (https://bugs.php.net/bug.php?id=53571).
I added the following to docker-php-ext-configure:
/usr/local/bin # diff -u docker-php-ext-configure.bak docker-php-ext-configure
--- docker-php-ext-configure.bak
+++ docker-php-ext-configure
## -54,5 +54,6 ##
set -x
cd "$ext"
+[[ ! -f "config.m4" && -f "config0.m4" ]] && mv config0.m4 config.m4
phpize
./configure "$#"
Alternatively, you can use this excellent helper to install the needed libs automatically for you.
https://github.com/mlocati/docker-php-extension-installer
You only need to list the extensions you want like this:
FROM php:8.2-fpm-alpine
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions; \
install-php-extensions mysqli mysqlnd pdo pdo_mysql zip
Take a look at its GitHub page to see all options available to use.

Can not find autoload.php when running laravel in a docker container

I am trying to run laravel on a docker container. However, I created a docker file to install the required dependencies and extensions. Then, I created a docker-compose file to run the container. But, when running the container using docker-compose up the following error appears:
Warning: require(/var/www/vendor/autoload.php): failed to open stream:
No such file or directory in /var/www/artisan on line 18 main_system_1
| main_system_1 | Fatal error: require(): Failed opening required
'/var/www/vendor/autoload.php' (include_path='.:/usr/local/lib/php')
in /var/www/artisan on line 18 workspace_main_system_1 exited with
code 255
The Dockerfile:
FROM php:alpine
# Install dev dependencies
RUN apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
curl-dev \
imagemagick-dev \
libtool \
libxml2-dev \
postgresql-dev \
sqlite-dev
# Install production dependencies
RUN apk add --no-cache \
bash \
curl \
g++ \
gcc \
git \
imagemagick \
libc-dev \
libpng-dev \
make \
mysql-client \
nodejs \
nodejs-npm \
yarn \
openssh-client \
postgresql-libs \
rsync \
zlib-dev \
libzip-dev
# Install PECL and PEAR extensions
RUN pecl install \
imagick
# Install and enable php extensions
RUN docker-php-ext-enable \
imagick
RUN docker-php-ext-configure zip --with-libzip
RUN docker-php-ext-install \
curl \
iconv \
mbstring \
pdo \
pdo_mysql \
pdo_pgsql \
pdo_sqlite \
pcntl \
tokenizer \
xml \
gd \
zip \
bcmath
# Install composer
ENV COMPOSER_HOME /composer
ENV PATH ./vendor/bin:/composer/vendor/bin:$PATH
ENV COMPOSER_ALLOW_SUPERUSER 1
RUN curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer
# Install PHP_CodeSniffer
RUN composer global require "squizlabs/php_codesniffer=*"
# Cleanup dev dependencies
RUN apk del -f .build-deps
# Setup working directory
WORKDIR /var/www
COPY composer.json composer.json
#COPY composer.lock composer.lock
RUN composer install --no-autoloader
COPY . .
RUN composer dump-autoload
RUN php artisan key:generate
RUN php artisan jwt:secret
RUN chmod 777 -R storage
CMD php artisan serve --host=0.0.0.0 --port=8000
EXPOSE 8000
And this is my docker-composr.yml file:
ersion: '3.1'
services:
main_system:
build: ./main-system
ports:
- 8000:8000
env_file: ./main-system/.env
volumes:
- ./main-system:/var/www
Your dockerfile runs composer install --no-autoloader. This may be the issue.
I solved the problem by:
removing the volume from docker-compose.yml
change the order of the COPY . . command and put it before RUN composer install
removing the --no-autoloader

Access my dockerized Laravel app in local

I am trying to dockerize a PHP / Laravel / VueJS app.
Here is the Dockerfile
FROM php:7.2-fpm
LABEL maintainer="contact#kendozone.com"
LABEL version="1.0.0"
LABEL description="Kendozone is a online tournament webapp coded with PHP / Laravel"
ENV node_version 10.8.0
ENV npm_version 6.4.1
ENV NVM_DIR /.nvm
ENV APP_DIR="/var/www"
ENV APP_PORT="80"
ENV DOCKER_FOLDER="docker/local"
RUN echo "deb http://ftp.de.debian.org/debian stretch main " >> /etc/apt/sources.list \
&& apt-get update -y
RUN apt-get install -y openssl zip unzip git gcc make automake \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
libmagickwand-dev vim --no-install-recommends
RUN apt-get purge --auto-remove -y g++ \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install pdo pdo_mysql mbstring zip -j$(nproc) iconv -j$(nproc) gd
WORKDIR $APP_DIR
COPY . $APP_DIR
RUN ls $APP_DIR \
&& touch $APP_DIR/database/sqlite.db \
&& mv $DOCKER_FOLDER/.env.local .env \
&& chown -R www-data:www-data $APP_DIR
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer install --no-interaction
RUN mkdir -p $NVM_DIR && chown -R www-data:www-data $NVM_DIR \
&& curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash \
&& [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" \
&& nvm install ${node_version}
ENV NODE_PATH $NVM_DIR/v$node_version/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$node_version/bin:$PATH
RUN npm install --save-exact imagemin-pngquant#5.0.* \
&& npm install \
&& npm run production \
&& php artisan key:generate \
&& php artisan migrate --seed
EXPOSE $APP_PORT
CMD php artisan serve --host=0.0.0.0 --port=$APP_PORT
the last line is supposed to run local server
Then I build it with :
docker build . -t xoco/kendozone:local-1.0.3
Then I run it with:
docker run -p 80:80 xoco/kendozone:local-1.0.3 -d bash
I can see on terminal the output:
[25-Oct-2018 19:56:40] NOTICE: fpm is running, pid 1
[25-Oct-2018 19:56:40] NOTICE: ready to handle connections
EDIT:
➜ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fee456200b85 xoco/kendozone:local-1.0.3 "docker-php-entrypoi…" 2 hours ago Up 2 hours 9000/tcp, 0.0.0.0:8080->80/tcp youthful_keldysh
Which seems to mean that everything is ok
But I can't reach my app on 127.0.0.1
What am I missing
You have to add host configuration file while using docker and add an entry for it inside /etc/hosts and try again.
I solved it with this command:
docker run -p 80:80 xoco/kendozone:local-1.0.3
Just remove -d bash at the end, and it should be OK

Build symfony docker container without DB

I have an symfony application, and i want to create docker container, that contains all needed files. The purpose is to spin up/down containers for scaling, without any other deploying processes. Just with given DB connection.
Building means, pretty much just git clone and running composer install, but some of symfony's post install scripts fail without configured DB.
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets
Can i not run these scripts when i'm building container? Or what the proper way to do symfony deployment?
Using Symfony 3.2, Doctrine2, PHP 7.1
The proper way to build a container without running the db script is by not running there scripts in the build,
Here is the one we use in production for api-platform:
FROM php:7.1-fpm-alpine
RUN apk add --no-cache --virtual .persistent-deps \
git \
icu-libs \
zlib \
postgresql-client
ENV APCU_VERSION 5.1.8
RUN set -xe \
&& apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
icu-dev \
zlib-dev \
postgresql-dev \
sqlite-dev \
pcre-dev \
&& docker-php-ext-install \
intl \
mbstring \
pdo_mysql \
pdo_pgsql \
pdo \
pgsql \
zip \
pdo_sqlite \
&& pecl install \
apcu-${APCU_VERSION} \
&& docker-php-ext-enable --ini-name 20-apcu.ini apcu \
&& docker-php-ext-enable --ini-name 05-opcache.ini opcache \
&& apk del .build-deps
COPY docker/php/php.ini /usr/local/etc/php/php.ini
COPY docker/php/install-composer.sh /usr/local/bin/docker-app-install-composer
RUN chmod +x /usr/local/bin/docker-app-install-composer
RUN set -xe \
&& apk add --no-cache --virtual .fetch-deps \
openssl \
&& docker-app-install-composer \
&& mv composer.phar /usr/local/bin/composer \
&& apk del .fetch-deps
ARG SYMFONY_ENV=dev
ENV SYMFONY_ENV=dev
RUN if [ "$SYMFONY_ENV" -ne "dev" ]; then \
sed -i '1 a xdebug.remote_enable=1' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
sed -i '1 a xdebug.remote_handler=dbgp' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
sed -i '1 a xdebug.remote_autostart=0' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
sed -i '1 a xdebug.remote_connect_back=1 ' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
sed -i '1 a xdebug.remote_port=9001' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
sed -i '1 a xdebug.remote_log=/var/log/xdebug_remote.log' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
pecl install \
xdebug \
&& docker-php-ext-enable xdebug; \
fi;
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
ENV COMPOSER_ALLOW_SUPERUSER 1
WORKDIR /srv/quotatis
COPY composer.json ./
COPY composer.lock ./
RUN mkdir -p \
var/cache \
var/logs \
var/sessions \
&& composer global require "hirak/prestissimo:^0.3" --prefer-dist --no-progress --no-suggest -o -a \
&& composer install --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress --no-suggest \
&& composer clear-cache \
# Permissions hack because setfacl does not work on Mac and Windows
&& chown -R www-data var
COPY app app/
COPY bin bin/
COPY src src/
COPY web web/
COPY etc etc/
RUN composer dump-autoload --optimize --classmap-authoritative --no-dev
COPY docker/php/start.sh /usr/local/bin/docker-app-start
RUN chmod +x /usr/local/bin/docker-app-start
CMD ["docker-app-start"]
You could see the whole stack (nginx + fpm + varnish on github)
The line that you need in here is this one
composer install --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress --no-suggest

How to install extension for php via docker-php-ext-install?

In order to resolve an issue, I am now trying install the mysql pdo via
docker-php-ext-install
as pointed out in the README of the php image.
Yet my call fails stating:
Libraries have been installed in:
/usr/src/php/ext/mysqli/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20131226/
Installing header files: /usr/local/include/php/
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la modules/* libs/*
+ cd /usr/src/php/ext/mysqlnd
+ phpize
Cannot find config.m4.
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module
ERROR: Service 'phlaconapp' failed to build: The command '/bin/sh -c docker-php-ext-install mysqli mysqlnd pdo pdo_mysql zip' returned a non-zero code: 1
This is my docker-compose.yml:
phlaconapp:
hostname: phaclonapp
dockerfile: Dockerfile
build: ./
ports:
- "1080:80"
- "1043:433"
environment:
TERM: xterm-color
ENVIRONMENT: dev
volumes:
- ./:/var/www/html/
links:
- mysql
mysql:
image: mysql:5.6
volumes:
- ./docker/mysql.d:/etc/mysql/conf.d
ports: ["3306:3306"]
environment:
MYSQL_ROOT_PASSWORD: 'root'
This is my Dockerfile:
FROM php:5.6-apache
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php -r "if (hash_file('SHA384', 'composer-setup.php') === '070854512ef404f16bac87071a6db9fd9721da1684cd4589b1196c3faf71b9a2682e2311b36a5079825e155ac7ce150d') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
php composer-setup.php && \
php -r "unlink('composer-setup.php');"
RUN apt-get update && \
apt-get install vim git -y
RUN docker-php-ext-install mysqli mysqlnd pdo pdo_mysql zip
RUN cd / && \
git clone --depth=1 git://github.com/phalcon/cphalcon.git && \
cd cphalcon/build && \
./install
RUN echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/phalcon.ini
RUN a2enmod rewrite
and running docker-compose build won't finish.
I had the same problem a while ago. I started a container and typed the ext-install command into this container. Once I found all the dependencies, I wrote them into the Dockerfile.
Example:
RUN apt-get update && apt-get install -y \
libmcrypt-dev \
&& docker-php-ext-install -j$(nproc) mcrypt
There is a dependency that libmcrypt-dev needed before you can run docker-php-ext-install mcrypt
I've checked my older Dockerfiles and found something which might help you
FROM php:5.6-apache
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
libicu-dev \
libxml2-dev \
vim \
wget \
unzip \
git \
&& docker-php-ext-install -j$(nproc) iconv intl xml soap mcrypt opcache pdo pdo_mysql mysqli mbstring \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd
RUN a2enmod rewrite && mkdir /composer-setup && wget https://getcomposer.org/installer -P /composer-setup && php /composer-setup/installer --install-dir=/usr/bin && rm -Rf /composer-setup && curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony && chmod a+x /usr/local/bin/symfony
# Create symlink for default conf
RUN ln -s /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-enabled/000-default.conf && mkdir /composer-setup && wget https://getcomposer.org/installer -P /composer-setup && php /composer-setup/installer --install-dir=/usr/bin && rm -Rf /composer-setup && curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony && chmod a+x /usr/local/bin/symfony
RUN docker-php-ext-install mbstring pdo pdo_mysql \
That code can do install any extension you want in this case mysql pdp driver but the Dockerfile should have base of FROM php:7.1.8-apache
The 2019 way and probably the 2020 way of installing memcached to your Docker PHP container is the way described on https://hub.docker.com/_/php
FROM php:latest
RUN pecl install memcached \
&& docker-php-ext-enable memcached
FROM php:5.6-cli
RUN apt-get update && apt-get install -y libmemcached-dev zlib1g-dev \
&& pecl install memcached-2.2.0 \
&& docker-php-ext-enable memcached
Seems to be a bug in phpize (https://bugs.php.net/bug.php?id=53571).
I added the following to docker-php-ext-configure:
/usr/local/bin # diff -u docker-php-ext-configure.bak docker-php-ext-configure
--- docker-php-ext-configure.bak
+++ docker-php-ext-configure
## -54,5 +54,6 ##
set -x
cd "$ext"
+[[ ! -f "config.m4" && -f "config0.m4" ]] && mv config0.m4 config.m4
phpize
./configure "$#"
Alternatively, you can use this excellent helper to install the needed libs automatically for you.
https://github.com/mlocati/docker-php-extension-installer
You only need to list the extensions you want like this:
FROM php:8.2-fpm-alpine
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions; \
install-php-extensions mysqli mysqlnd pdo pdo_mysql zip
Take a look at its GitHub page to see all options available to use.

Categories