Ошибка при запуске Docker файле c конфигурацией для php8

Пишу образ для запуска Laravel. Образ собирается, фреймворк запускается, только нельзя работать с базой данных, потому что я закомментировал в Docker файле эти строчки

# RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
# RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/

Где-то нашел инфу что для этой конфигурации они не нужны

А закомментировал я их потому что при попытке собрать образ возникала ошибка. Пытался разобраться сам, и конфиг работает, только если я ставлю версию php7.4, но php обновляется часто, если мне надо будет перейти на другую версию то снова поймаю эту ошибку. Хочу понять причину а не уходить от проблемы. Но информацию по ошибке не нахожу.

Ниже текст из консоли полностью, чтобы ничего не упустить

------
=> ERROR [5/8] RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl    
 > [5/8] RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl:
#8 2.040 Configuring for:
#8 2.040 PHP Api Version:         20200930
#8 2.040 Zend Module Api No:      20200930
#8 2.040 Zend Extension Api No:   420200930
#8 2.780 checking for grep that handles long lines and -e... /bin/grep
#8 2.784 checking for egrep... /bin/grep -E
#8 2.785 checking for a sed that does not truncate output... /bin/sed
#8 2.813 checking for pkg-config... /usr/bin/pkg-config
#8 2.813 checking pkg-config is at least version 0.9.0... yes
#8 2.815 checking for cc... cc
#8 2.837 checking whether the C compiler works... yes
#8 2.873 checking for C compiler default output file name... a.out
#8 2.875 checking for suffix of executables...
#8 2.914 checking whether we are cross compiling... no
#8 2.959 checking for suffix of object files... o
#8 2.980 checking whether we are using the GNU C compiler... yes
#8 3.002 checking whether cc accepts -g... yes
#8 3.023 checking for cc option to accept ISO C89... none needed
#8 3.058 checking how to run the C preprocessor... cc -E
#8 3.108 checking for icc... no
#8 3.118 checking for suncc... no
#8 3.127 checking for system library directory... lib
#8 3.127 checking if compiler supports -Wl,-rpath,... yes
#8 3.170 checking build system type... x86_64-pc-linux-gnu
#8 3.175 checking host system type... x86_64-pc-linux-gnu
#8 3.176 checking target system type... x86_64-pc-linux-gnu
#8 3.212 checking for PHP prefix... /usr/local
#8 3.212 checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/
date/lib
#8 3.212 checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20200930
#8 3.213 checking for PHP installed headers prefix... /usr/local/include/php
#8 3.213 checking if debug is enabled... no
#8 3.229 checking if zts is enabled... no
#8 3.245 checking for gawk... no
#8 3.246 checking for nawk... nawk
#8 3.247 checking if nawk is broken... no
#8 3.248 checking for MySQL support for PDO... yes, shared
#8 3.249 checking for the location of libz... no
#8 3.250 checking for MySQL UNIX socket location...
#8 3.251 checking for PDO includes... /usr/local/include/php/ext
#8 3.259 checking for a sed that does not truncate output... /bin/sed
#8 3.262 checking for ld used by cc... /usr/bin/ld
#8 3.267 checking if the linker (/usr/bin/ld) is GNU ld... yes
#8 3.269 checking for /usr/bin/ld option to reload object files... -r
#8 3.270 checking for BSD-compatible nm... /usr/bin/nm -B
#8 3.273 checking whether ln -s works... yes
#8 3.273 checking how to recognize dependent libraries... pass_all
#8 3.289 checking for ANSI C header files... yes
#8 3.388 checking for sys/types.h... yes
#8 3.418 checking for sys/stat.h... yes
#8 3.449 checking for stdlib.h... yes
#8 3.479 checking for string.h... yes
#8 3.511 checking for memory.h... yes
#8 3.543 checking for strings.h... yes
#8 3.573 checking for inttypes.h... yes
#8 3.605 checking for stdint.h... yes
#8 3.638 checking for unistd.h... yes
#8 3.670 checking dlfcn.h usability... yes
#8 3.697 checking dlfcn.h presence... yes
#8 3.707 checking for dlfcn.h... yes
#8 3.708 checking the maximum length of command line arguments... 1572864
#8 3.713 checking command to parse /usr/bin/nm -B output from cc object... ok
#8 3.779 checking for objdir... .libs
#8 3.784 checking for ar... ar
#8 3.785 checking for ranlib... ranlib
#8 3.786 checking for strip... strip
#8 3.836 checking if cc supports -fno-rtti -fno-exceptions... no
#8 3.858 checking for cc option to produce PIC... -fPIC
#8 3.859 checking if cc PIC flag -fPIC works... yes
#8 3.879 checking if cc static flag -static works... yes
#8 3.961 checking if cc supports -c -o file.o... yes
#8 3.988 checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
#8 4.003 checking whether -lc should be explicitly linked in... no
#8 4.029 checking dynamic linker characteristics... GNU/Linux ld.so
#8 4.045 checking how to hardcode library paths into programs... immediate
#8 4.045 checking whether stripping libraries is possible... yes
#8 4.049 checking if libtool supports shared libraries... yes
#8 4.049 checking whether to build shared libraries... yes
#8 4.049 checking whether to build static libraries... no
#8 4.199
#8 4.199 creating libtool
#8 4.219 appending configuration tag "CXX" to libtool
#8 4.288 configure: patching config.h.in
#8 4.291 configure: creating ./config.status
#8 4.338 config.status: creating config.h
#8 4.377 /bin/bash /usr/src/php/ext/pdo_mysql/libtool --mode=compile cc -I. -I/usr/src/php/ext/pdo_mysql -I/usr/src/php/ext/pdo_mysql/include -I/usr/src/php/ext/pdo_mysql/main -I/usr/src/php/ext/pdo_mysql -I/usr
/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fp
ie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -I/usr/local/include/php/ext -DZEND_ENABLE_STATIC_TSRMLS_C
ACHE=1 -c /usr/src/php/ext/pdo_mysql/pdo_mysql.c -o pdo_mysql.lo
#8 4.463 mkdir .libs
#8 4.466  cc -I. -I/usr/src/php/ext/pdo_mysql -I/usr/src/php/ext/pdo_mysql/include -I/usr/src/php/ext/pdo_mysql/main -I/usr/src/php/ext/pdo_mysql -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/loc
al/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CON
FIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/local/include/php/ext -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/pdo_mysql/pdo_mysql.c  -fPIC -DPIC -
o .libs/pdo_mysql.o
#8 4.683 /bin/bash /usr/src/php/ext/pdo_mysql/libtool --mode=compile cc -I. -I/usr/src/php/ext/pdo_mysql -I/usr/src/php/ext/pdo_mysql/include -I/usr/src/php/ext/pdo_mysql/main -I/usr/src/php/ext/pdo_mysql -I/usr
/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fp
ie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -I/usr/local/include/php/ext -DZEND_ENABLE_STATIC_TSRMLS_C
ACHE=1 -c /usr/src/php/ext/pdo_mysql/mysql_driver.c -o mysql_driver.lo
#8 4.773  cc -I. -I/usr/src/php/ext/pdo_mysql -I/usr/src/php/ext/pdo_mysql/include -I/usr/src/php/ext/pdo_mysql/main -I/usr/src/php/ext/pdo_mysql -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/loc
al/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CON
FIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/local/include/php/ext -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/pdo_mysql/mysql_driver.c  -fPIC -DPI
C -o .libs/mysql_driver.o
#8 5.152 /bin/bash /usr/src/php/ext/pdo_mysql/libtool --mode=compile cc -I. -I/usr/src/php/ext/pdo_mysql -I/usr/src/php/ext/pdo_mysql/include -I/usr/src/php/ext/pdo_mysql/main -I/usr/src/php/ext/pdo_mysql -I/usr
/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fp
ie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -I/usr/local/include/php/ext -DZEND_ENABLE_STATIC_TSRMLS_C
ACHE=1 -c /usr/src/php/ext/pdo_mysql/mysql_statement.c -o mysql_statement.lo
#8 5.239  cc -I. -I/usr/src/php/ext/pdo_mysql -I/usr/src/php/ext/pdo_mysql/include -I/usr/src/php/ext/pdo_mysql/main -I/usr/src/php/ext/pdo_mysql -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/loc
al/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CON
FIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/local/include/php/ext -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/pdo_mysql/mysql_statement.c  -fPIC -
DPIC -o .libs/mysql_statement.o
#8 5.541 /bin/bash /usr/src/php/ext/pdo_mysql/libtool --mode=link cc -shared -I/usr/src/php/ext/pdo_mysql/include -I/usr/src/php/ext/pdo_mysql/main -I/usr/src/php/ext/pdo_mysql -I/usr/local/include/php -I/usr/lo
cal/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -
D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -Wl,-O1 -pie  -o pdo_mysql.la -export-dynamic -avoid-version -prefer-pic -module -rpath
 /usr/src/php/ext/pdo_mysql/modules  pdo_mysql.lo mysql_driver.lo mysql_statement.lo
#8 5.645 cc -shared  .libs/pdo_mysql.o .libs/mysql_driver.o .libs/mysql_statement.o   -Wl,-O1 -Wl,-soname -Wl,pdo_mysql.so -o .libs/pdo_mysql.so
#8 5.662 creating pdo_mysql.la
#8 5.671 (cd .libs && rm -f pdo_mysql.la && ln -s ../pdo_mysql.la pdo_mysql.la)
#8 5.674 /bin/bash /usr/src/php/ext/pdo_mysql/libtool --mode=install cp ./pdo_mysql.la /usr/src/php/ext/pdo_mysql/modules
#8 5.703 cp ./.libs/pdo_mysql.so /usr/src/php/ext/pdo_mysql/modules/pdo_mysql.so
#8 5.707 cp ./.libs/pdo_mysql.lai /usr/src/php/ext/pdo_mysql/modules/pdo_mysql.la
#8 5.728 PATH="$PATH:/sbin" ldconfig -n /usr/src/php/ext/pdo_mysql/modules
#8 5.731 ----------------------------------------------------------------------
#8 5.731 Libraries have been installed in:
#8 5.731    /usr/src/php/ext/pdo_mysql/modules
#8 5.731
#8 5.731 If you ever happen to want to link against installed libraries
#8 5.731 in a given directory, LIBDIR, you must either use libtool, and
#8 5.731 specify the full pathname of the library, or use the `-LLIBDIR'
#8 5.731 flag during linking and do at least one of the following:
#8 5.731    - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
#8 5.731      during execution
#8 5.731    - add LIBDIR to the `LD_RUN_PATH' environment variable
#8 5.731      during linking
#8 5.731    - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
#8 5.731    - have your system administrator add LIBDIR to `/etc/ld.so.conf'
#8 5.732
#8 5.732 See any operating system documentation about shared libraries for
#8 5.732 more information, such as the ld(1) and ld.so(8) manual pages.
#8 5.734 ----------------------------------------------------------------------
#8 5.736
#8 5.738 Build complete.
#8 5.739 Don't forget to run 'make test'.
#8 5.740
#8 5.742 + strip --strip-all modules/pdo_mysql.so
#8 5.764 Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
#8 5.828 find . -name \*.gcno -o -name \*.gcda | xargs rm -f
#8 5.832 find . -name \*.lo -o -name \*.o | xargs rm -f
#8 5.836 find . -name \*.la -o -name \*.a | xargs rm -f
#8 5.840 find . -name \*.so | xargs rm -f
#8 5.844 find . -name .libs -a -type d|xargs rm -rf
#8 5.847 rm -f libphp.la      modules/* libs/*
#8 5.849 rm -f ext/opcache/jit/zend_jit_x86.c
#8 5.878 Configuring for:
#8 5.878 PHP Api Version:         20200930
#8 5.878 Zend Module Api No:      20200930
#8 5.878 Zend Extension Api No:   420200930
#8 6.615 checking for grep that handles long lines and -e... /bin/grep
#8 6.617 checking for egrep... /bin/grep -E
#8 6.619 checking for a sed that does not truncate output... /bin/sed
#8 6.646 checking for pkg-config... /usr/bin/pkg-config
#8 6.646 checking pkg-config is at least version 0.9.0... yes
#8 6.649 checking for cc... cc
#8 6.672 checking whether the C compiler works... yes
#8 6.708 checking for C compiler default output file name... a.out
#8 6.709 checking for suffix of executables...
#8 6.743 checking whether we are cross compiling... no
#8 6.784 checking for suffix of object files... o
#8 6.805 checking whether we are using the GNU C compiler... yes
#8 6.824 checking whether cc accepts -g... yes
#8 6.844 checking for cc option to accept ISO C89... none needed
#8 6.876 checking how to run the C preprocessor... cc -E
#8 6.926 checking for icc... no
#8 6.935 checking for suncc... no
#8 6.944 checking for system library directory... lib
#8 6.944 checking if compiler supports -Wl,-rpath,... yes
#8 6.984 checking build system type... x86_64-pc-linux-gnu
#8 6.990 checking host system type... x86_64-pc-linux-gnu
#8 6.990 checking target system type... x86_64-pc-linux-gnu
#8 7.026 checking for PHP prefix... /usr/local
#8 7.026 checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/
date/lib
#8 7.026 checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20200930
#8 7.026 checking for PHP installed headers prefix... /usr/local/include/php
#8 7.026 checking if debug is enabled... no
#8 7.042 checking if zts is enabled... no
#8 7.057 checking for gawk... no
#8 7.058 checking for nawk... nawk
#8 7.058 checking if nawk is broken... no
#8 7.060 checking whether to enable multibyte string support... yes, shared
#8 7.060 checking whether to enable multibyte regex support (requires oniguruma)... yes
#8 7.062 checking for oniguruma... no
#8 7.068 configure: error: Package requirements (oniguruma) were not met:
#8 7.068
#8 7.068 No package 'oniguruma' found
#8 7.068
#8 7.068 Consider adjusting the PKG_CONFIG_PATH environment variable if you
#8 7.068 installed software in a non-standard prefix.
#8 7.068
#8 7.068 Alternatively, you may set the environment variables ONIG_CFLAGS
#8 7.068 and ONIG_LIBS to avoid the need to call pkg-config.
#8 7.068 See the pkg-config man page for more details.
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c docker-php-ext-install pdo_mysql mbstring zip exif pcntl]: exit code: 1

Весь конфиг выглядит следующим образом

FROM php:8.0-fpm

USER root

# Set working directory
WORKDIR /var/www

# Install dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    libzip-dev \
    libpng-dev \
    libjpeg62-turbo-dev \
    libwebp-dev libjpeg62-turbo-dev libpng-dev libxpm-dev \
    libfreetype6 \
    libfreetype6-dev \
    locales \
    zip \
    jpegoptim optipng pngquant gifsicle \
    vim \
    unzip \
    git \
    curl


# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Install extensions
# RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
# RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/

# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Copy existing application directory contents
COPY ./src /var/www

# Copy existing application directory permissions

# Change current user to www-data
USER www-data

# Expose port 9000 and start php-fpm server
EXPOSE 9000
CMD ["php-fpm"]

И файл docker-compose.yml

version: "3.7"
services:
  app:
    build:
      context: .
      dockerfile: ./.docker/php/Dockerfile
    image: php:8.0-fpm
    container_name: laravel_app
    restart: unless-stopped
    tty: true
    working_dir: /var/www
    volumes:
      - ./src:/var/www
    networks:
      - laravel

  db:
    image: mysql:8
      #image: mariadb:10 #— For MacOS on ARM
    container_name: laravel_db
    command:
      - --character-set-server=utf8mb4
      - --default-authentication-plugin=mysql_native_password
      #- —secure-file-priv=/var/lib/mysql #— For MacOS on ARM
    restart: unless-stopped
    tty: true
    ports:
      - "3306:3306"
    environment:
      MYSQL_PASSWORD: root
      MYSQL_ROOT_PASSWORD: root
      MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
      SERVICE_TAGS: laravel
    volumes:
      - ./.docker/mysql/data:/var/lib/mysql/
    cap_add:
      - ALL
    networks:
      - laravel

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: laravel_pma
    depends_on:
      - db
    environment:
      SERVICE_TAGS: laravel
    restart: unless-stopped
    ports:
      - "8888:80"
    networks:
      - laravel

  nginx:
    image: nginx:1.17-alpine
    container_name: laravel_nginx
    restart: unless-stopped
    ports:
      - "7777:80"
    volumes:
      - ./src:/var/www
      - ./.docker/nginx/conf.d:/etc/nginx/conf.d
    networks:
      - laravel

networks:
  laravel:
    driver: bridge

volumes:
  dbdata:
    driver: local

Ответы (0 шт):