簡體   English   中英

無法在 docker alpine 版本 3.14 或最新版本上安裝 php-gd

[英]Impossible to install php-gd on docker alpine version 3.14 or newest

我試圖在 PHP 容器上構建 gd,並且無法使用 alpine 版本 3.14 或 3.15 構建它,但使用 alpine 3.13 可以正常工作。

我的 Dockerfile

FROM php:8.0-fpm-alpine
RUN apk add --no-cache libpng libpng-dev && docker-php-ext-install gd && apk del libpng-dev

output:

Sending build context to Docker daemon  22.45MB
Step 1/2 : FROM php:8.0-fpm-alpine
8.0-fpm-alpine: Pulling from library/php
59bf1c3509f3: Already exists 
7c7da25b2876: Already exists 
2bc599114627: Already exists 
927a0b37a45a: Already exists 
8279146e52ed: Pull complete 
f188883b50e9: Pull complete 
56c64d4e1e11: Pull complete 
003d402c413f: Pull complete 
6be58cf002ec: Pull complete 
944bcdcab902: Pull complete 
Digest: sha256:de0dfab2d08ff7734a7ec5618adcd79a7e62c7af1cc87bdf0c383f3f9fc5d69c
Status: Downloaded newer image for php:8.0-fpm-alpine
 ---> 9f8b491e71dc
Step 2/2 : RUN apk add --no-cache libpng libpng-dev && docker-php-ext-install gd && apk del libpng-dev
 ---> Running in ce1bdea67e8c
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
(1/4) Installing libpng (1.6.37-r1)
(2/4) Installing pkgconf (1.8.0-r0)
(3/4) Installing zlib-dev (1.2.11-r3)
(4/4) Installing libpng-dev (1.6.37-r1)
Executing busybox-1.34.1-r3.trigger
OK: 14 MiB in 36 packages
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
(1/25) Installing m4 (1.4.18-r2)
(2/25) Installing libbz2 (1.0.8-r1)
(3/25) Installing perl (5.34.0-r1)
(4/25) Installing autoconf (2.71-r0)
(5/25) Installing dpkg-dev (1.20.9-r0)
(6/25) Installing dpkg (1.20.9-r0)
(7/25) Installing libmagic (5.41-r0)
(8/25) Installing file (5.41-r0)
(9/25) Installing libgcc (10.3.1_git20211027-r0)
(10/25) Installing libstdc++ (10.3.1_git20211027-r0)
(11/25) Installing binutils (2.37-r3)
(12/25) Installing libgomp (10.3.1_git20211027-r0)
(13/25) Installing libatomic (10.3.1_git20211027-r0)
(14/25) Installing libgphobos (10.3.1_git20211027-r0)
(15/25) Installing gmp (6.2.1-r0)
(16/25) Installing isl22 (0.22-r0)
(17/25) Installing mpfr4 (4.1.0-r0)
(18/25) Installing mpc1 (1.2.1-r0)
(19/25) Installing gcc (10.3.1_git20211027-r0)
(20/25) Installing musl-dev (1.2.2-r7)
(21/25) Installing libc-dev (0.7.2-r3)
(22/25) Installing g++ (10.3.1_git20211027-r0)
(23/25) Installing make (4.3-r0)
(24/25) Installing re2c (2.1.1-r0)
(25/25) Installing .phpize-deps (20211201.091725)
Executing busybox-1.34.1-r3.trigger
OK: 248 MiB in 61 packages
Configuring for:
PHP Api Version:         20200930
Zend Module Api No:      20200930
Zend Extension Api No:   420200930
configure.ac:18: warning: $as_echo is obsolete; use AS_ECHO(["message"]) instead
build/php.m4:2072: PHP_CONFIG_NICE is expanded from...
configure.ac:18: the top level
configure.ac:161: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:161: You should run autoupdate.
./lib/autoconf/c.m4:72: AC_LANG_C is expanded from...
build/libtool.m4:2728: _LT_AC_LANG_C_CONFIG is expanded from...
build/libtool.m4:2727: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:161: You should run autoupdate.
./lib/autoconf/c.m4:72: AC_LANG_C is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
build/libtool.m4:561: _LT_AC_LOCK is expanded from...
build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2728: _LT_AC_LANG_C_CONFIG is expanded from...
build/libtool.m4:2727: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:161: You should run autoupdate.
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
build/libtool.m4:561: _LT_AC_LOCK is expanded from...
build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2728: _LT_AC_LANG_C_CONFIG is expanded from...
build/libtool.m4:2727: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2728: _LT_AC_LANG_C_CONFIG is expanded from...
build/libtool.m4:2727: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2728: _LT_AC_LANG_C_CONFIG is expanded from...
build/libtool.m4:2727: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile' does not exist
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: output file \`$ofile' does not exist
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile' does not look like a libtool script
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: output file \`$ofile' does not look like a libtool script
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: tag name \"$tagname\" already exists
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: The macro `AC_LANG_CPLUSPLUS' is obsolete.
configure.ac:161: You should run autoupdate.
./lib/autoconf/c.m4:262: AC_LANG_CPLUSPLUS is expanded from...
build/libtool.m4:2810: _LT_AC_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:2809: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2810: _LT_AC_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:2809: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2810: _LT_AC_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:2809: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether cc accepts -g... yes
checking for cc option to enable C11 features... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-musl
checking host system type... x86_64-pc-linux-musl
checking target system type... x86_64-pc-linux-musl
checking for PHP prefix... /usr/local
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
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20200930
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for GD support... yes, shared
checking for external libgd... no
checking for libwebp... no
checking for libjpeg... no
checking for libXpm... no
checking for FreeType 2... no
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for fabsf... yes
checking for floorf... yes
checking for zlib... yes
checking for libpng... yes
checking for a sed that does not truncate output... /bin/sed
checking for ld used by cc... /usr/x86_64-alpine-linux-musl/bin/ld
checking if the linker (/usr/x86_64-alpine-linux-musl/bin/ld) is GNU ld... yes
checking for /usr/x86_64-alpine-linux-musl/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 98304
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
/bin/sh /usr/src/php/ext/gd/libtool --mode=compile cc -I. -I/usr/src/php/ext/gd -I/usr/src/php/ext/gd/include -I/usr/src/php/ext/gd/main -I/usr/src/php/ext/gd -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 -I/usr/include/libpng16  -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   -I/usr/src/php/ext/gd/libgd -c /usr/src/php/ext/gd/gd.c -o gd.lo 
make: /bin/sh: Operation not permitted
make: *** [Makefile:212: gd.lo] Error 127
The command '/bin/sh -c apk add --no-cache libpng libpng-dev && docker-php-ext-install gd && apk del libpng-dev' returned a non-zero code: 2

php 容器 7.4-fpm-alpine / 8.0-fpm-alpine / 8.1-fpm-alpine 總是同樣的錯誤。

不幸的是,我使用 alpine 版本 3.13 的解決方法工作正常(7.4-fpm-alpine3.13 / 8.0-fpm-alpine3.13),但 php 沒有為 ZE1BFD762321E409CEE4AC0B6E841963.CZ 構建 alpine 版本 3.13。

那么,有人有想法嗎?

好的,我發現了問題。

我使用的是舊版本的 docker (18.09.7),在 docker 20.10.11 上一切正常。

有人在這里遇到類似的問題: https://github.com/docker-library/php/issues/1233

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM