Docker cannot open php.ini "/usr/local/etc/php" for writing - php

My Dockerfile builds the PHP container seemingly without errors and all added PHP extensions are loaded Additional .ini files parsed. But when looking at the output during the build I see this:
#10 71.97 Build process completed successfully
#10 71.97 Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so'
#10 71.98 install ok: channel://pecl.php.net/xdebug-3.2.0
#10 71.98 cannot open php.ini "/usr/local/etc/php" for writing
#10 71.98 You should add "extension=imagick.so" to php.ini
#10 71.98 cannot open php.ini "/usr/local/etc/php" for writing
#10 71.98 You should add "extension=imagick.so" to php.ini
#10 71.98 cannot open php.ini "/usr/local/etc/php" for writing
#10 71.98 You should add "extension=redis.so" to php.ini
#10 71.98 cannot open php.ini "/usr/local/etc/php" for writing
#10 71.98 You should add "extension=imagick.so" to php.ini
#10 71.98 cannot open php.ini "/usr/local/etc/php" for writing
#10 71.98 You should add "extension=redis.so" to php.ini
#10 71.98 cannot open php.ini "/usr/local/etc/php" for writing
#10 71.98 You should add "extension=memcached.so" to php.ini
#10 71.98 cannot open php.ini "/usr/local/etc/php" for writing
#10 71.98 You should add "zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so" to php.ini
#10 71.98 cannot open php.ini "/usr/local/etc/php" for writing
#10 71.98 You should add "zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so" to php.ini
#10 71.98 cannot open php.ini "/usr/local/etc/php" for writing
#10 71.98 You should add "zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so" to php.ini
#10 71.98 cannot open php.ini "/usr/local/etc/php" for writing
#10 71.98 You should add "zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so" to php.ini
#10 72.05 fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/APKINDEX.tar.gz
#10 72.32 fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/community/x86_64/APKINDEX.tar.gz
#10 72.54 (1/1) Installing .docker-php-ext-enable-deps (20230202.070642)
#10 72.55 OK: 459 MiB in 136 packages
#10 72.84 (1/1) Purging .docker-php-ext-enable-deps (20230202.070642)
#10 72.84 OK: 459 MiB in 135 packages
Should I just ignore it or is there some way to fix it?
The Dockerfile:
FROM php:8.2-fpm-alpine
RUN pear config-set php_ini "$PHP_INI_DIR"
RUN apk update && apk upgrade && apk add --no-cache $PHPIZE_DEPS libzip-dev zlib-dev gmp-dev libmemcached-dev linux-headers imagemagick-dev libpng-dev libwebp-dev libjpeg-turbo-dev freetype-dev \
&& docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp \
&& docker-php-ext-install gd gmp pdo_mysql opcache zip
# I have tried adding this and still I get the same error
# php.ini will in this case be owned by `root` in the container
# If I add the user "docker" and let that user own the file I get the same error
RUN cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini
RUN pecl install imagick redis memcached xdebug \
&& docker-php-ext-enable imagick redis memcached xdebug
COPY ./xdebug/xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
RUN addgroup -g 1000 docker && adduser -D -u 1000 -G docker -s /bin/sh docker
USER docker
Relevant screenshots:

Related

Windows 10: Docker build fails on apt-get upgrade with 403 authenticationrequired

I am trying to build a docker image for a php 5.6 application on my work machine. The initial steps on Dockerfile are as below:
FROM php:5.6-apache
RUN set -x \
&& apt-get update \
&& apt-get upgrade -y
When I run docker build I get the following output along with an error after the apt-get upgrade command:
#5 0.365 + apt-get update
#5 0.965 Get:1 http://security.debian.org/debian-security stretch/updates InRelease [59.1 kB]
#5 0.977 Ign:2 http://deb.debian.org/debian stretch InRelease
#5 1.223 Get:3 http://deb.debian.org/debian stretch-updates InRelease [93.6 kB]
#5 1.318 Get:4 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [782 kB]
#5 1.478 Get:5 http://deb.debian.org/debian stretch Release [118 kB]
#5 1.784 Get:6 http://deb.debian.org/debian stretch Release.gpg [3177 B]
#5 1.999 Get:7 http://deb.debian.org/debian stretch/main amd64 Packages [7080 kB]
#5 5.073 Fetched 8135 kB in 4s (1742 kB/s)
#5 5.073 Reading package lists...
#5 5.686 + apt-get upgrade -y
#5 5.701 Reading package lists...
#5 6.318 Building dependency tree...
#5 6.433 Reading state information...
#5 6.444 Calculating upgrade...
#5 6.733 The following packages will be upgraded:
#5 6.733 apache2 apache2-bin apache2-data apache2-utils apt base-files
#5 6.733 ca-certificates curl debian-archive-keyring dpkg dpkg-dev e2fslibs e2fsprogs
#5 6.733 file gpgv gzip libapr1 libapt-pkg5.0 libbsd0 libc-bin libc-dev-bin libc6
#5 6.733 libc6-dev libcomerr2 libcurl3 libdpkg-perl libexpat1 libgcrypt20
#5 6.733 libglib2.0-0 libgmp10 libgnutls30 libgssapi-krb5-2 libhogweed4 libicu57
#5 6.733 libidn11 libk5crypto3 libkrb5-3 libkrb5support0 libldap-2.4-2 libldap-common
#5 6.733 liblz4-1 liblzma5 libmagic-mgc libmagic1 libnettle6 libnghttp2-14
#5 6.733 libp11-kit0 libperl5.24 libsasl2-2 libsasl2-modules-db libsqlite3-0 libss2
#5 6.733 libssh2-1 libssl1.0.2 libssl1.1 libsystemd0 libudev1 libxml2 linux-libc-dev
#5 6.733 login multiarch-support openssl passwd patch perl perl-base
#5 6.733 perl-modules-5.24 tar tzdata xz-utils zlib1g
#5 7.050 71 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
#5 7.050 Need to get 51.0 MB of archives.
#5 7.050 After this operation, 505 kB of additional disk space will be used.
#5 7.050 Get:1 http://security.debian.org/debian-security stretch/updates/main amd64 tar amd64 1.29b-1.1+deb9u1 [760 kB]
#5 7.062 Get:2 http://deb.debian.org/debian stretch/main amd64 base-files amd64 9.9+deb9u13 [67.6 kB]
#5 7.315 Get:3 http://deb.debian.org/debian stretch/main amd64 libc6-dev amd64 2.24-11+deb9u4 [2364 kB]
#5 8.159 Err:4 http://deb.debian.org/debian stretch/main amd64 libc-dev-bin amd64 2.24-11+deb9u4
#5 8.159 403 authenticationrequired
...
...
#5 9.424 Failed to fetch http://deb.debian.org/debian/pool/main/g/glibc/libc6_2.24-11+deb9u4_amd64.deb 403 authenticationrequired
#5 9.424 E: Failed to fetch http://security.debian.org/debian-security/pool/updates/main/e/e2fsprogs/e2fslibs_1.43.4-2+deb9u2_amd64.deb 403 authenticationrequired [IP: 151.101.194.132 80]
#5 9.424 E: Failed to fetch http://security.debian.org/debian-security/pool/updates/main/e/e2fsprogs/e2fsprogs_1.43.4-2+deb9u2_amd64.deb 403 authenticationrequired [IP: 151.101.194.132 80]
...
...
I know there is a missing config for my docker setup but not sure what it is. I tried installing Docker with wsl, uninstalled it and installed again with Hyper V , but the same issue. Any helpful pointers?
The workaround for this is to install docker CE on a WSL instance (I used ubuntu) on windows. Shutdown docker desktop on host windows machine. Then build the image on the WSL and push it to your docker registry. This way the image can be used anywhere.
Not sure why but docker desktop is not so useful in this case.

laravel sail always error when doing "sail up"

been like 3 hours trying laravel sail and it always error "#0 615.4 /bin/sh: 1: npm: not found"
[+] Building 624.0s (9/16)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.90kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:22.04 8.4s
=> [auth] library/ubuntu:pull token for registry-1.docker.io 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 99B 0.0s
=> [ 1/11] FROM docker.io/library/ubuntu:22.04#sha256:34fea4f31bf187bc915536831fd0afc9d214755b 0.0s
=> CACHED [ 2/11] WORKDIR /var/www/html 0.0s
=> CACHED [ 3/11] RUN ln -snf /usr/share/zoneinfo/UTC /etc/localtime && echo UTC > /etc/timezo 0.0s
=> ERROR [ 4/11] RUN apt-get update && apt-get install -y gnupg gosu curl ca-certificate 615.5s
------
> [ 4/11] RUN apt-get update && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 && mkdir -p ~/.gnupg && chmod 600 ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf && echo "keyserver hkp://keyserver.ubuntu.com:80" >> ~/.gnupg/dirmngr.conf && gpg --recv-key 0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c && gpg --export 0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c > /usr/share/keyrings/ppa_ondrej_php.gpg && echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list && apt-get update && apt-get install -y php8.1-cli php8.1-dev php8.1-pgsql php8.1-sqlite3 php8.1-gd php8.1-curl php8.1-imap php8.1-mysql php8.1-mbstring php8.1-xml php8.1-zip php8.1-bcmath php8.1-soap php8.1-intl php8.1-readline php8.1-ldap php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole php8.1-memcached php8.1-pcov php8.1-xdebug && php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer && curl -sLS https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs && npm install -g npm && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarn.gpg >/dev/null && echo "deb [signed-by=/usr/share/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null && echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list && apt-get update && apt-get install -y yarn && apt-get install -y mysql-client && apt-get install -y postgresql-client-14 && apt-get -y autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*:
#0 0.964 Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
#0 1.118 Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
#0 2.334 Get:3 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [128 kB]
#0 2.737 Get:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [114 kB]
#0 3.024 Get:5 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [305 kB]
#0 3.399 Get:6 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB]
#0 4.058 Get:7 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
#0 4.183 Get:8 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [4644 B]
#0 4.230 Get:9 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [276 kB]
#0 75.08 Get:10 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1792 kB]
#0 82.16 Get:11 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]
#0 83.28 Get:12 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]
#0 83.93 Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [319 kB]
#0 85.68 Get:14 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [7791 B]
#0 85.68 Get:15 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [604 kB]
#0 87.97 Get:16 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [252 kB]
#0 89.35 Get:17 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [5814 B]
#0 89.37 Fetched 22.2 MB in 1min 29s (249 kB/s)
#0 89.37 Reading package lists...
#0 89.90 Reading package lists...
#0 90.39 Building dependency tree...
#0 90.57 Reading state information...
#0 90.70 The following additional packages will be installed:
#0 90.70 dirmngr fontconfig-config fonts-dejavu-core git-man gnupg-l10n gnupg-utils
#0 90.70 gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm less libassuan0
#0 90.70 libbrotli1 libbsd0 libc-dev-bin libc-devtools libc6-dev libcbor0.8
#0 90.70 libcrypt-dev libcurl3-gnutls libcurl4 libdeflate0 libedit2 liberror-perl
#0 90.70 libexpat1 libfido2-1 libfontconfig1 libfreetype6 libgd3 libgdbm-compat4
#0 90.70 libgdbm6 libjbig0 libjpeg-turbo8 libjpeg8 libksba8 libldap-2.5-0
#0 90.70 libldap-common libmd0 libmpdec3 libnghttp2-14 libnpth0 libnsl-dev libpam-cap
#0 90.70 libperl5.34 libpng-tools libpng16-16 libpsl5 libpython2-stdlib
#0 90.70 libpython2.7-minimal libpython2.7-stdlib libpython3-stdlib
#0 90.70 libpython3.10-minimal libpython3.10-stdlib libreadline8 librtmp1 libsasl2-2
#0 90.70 libsasl2-modules libsasl2-modules-db libsqlite3-0 libssh-4 libtiff5
#0 90.70 libtirpc-dev libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6
#0 90.70 libxext6 libxmuu1 libxpm4 linux-libc-dev manpages manpages-dev media-types
#0 90.70 netbase openssh-client openssl patch perl perl-modules-5.34 pinentry-curses
#0 90.70 publicsuffix python2-minimal python2.7 python2.7-minimal python3
#0 90.70 python3-minimal python3-pkg-resources python3.10 python3.10-minimal
#0 90.70 readline-common rpcsvc-proto ucf xauth zlib1g-dev
#0 90.70 Suggested packages:
#0 90.70 dbus-user-session libpam-systemd pinentry-gnome3 tor gettext-base
#0 90.70 git-daemon-run | git-daemon-sysvinit git-doc git-email git-gui gitk gitweb
#0 90.70 git-cvs git-mediawiki git-svn parcimonie xloadimage scdaemon glibc-doc
#0 90.70 libgd-tools gdbm-l10n libsasl2-modules-gssapi-mit
#0 90.70 | libsasl2-modules-gssapi-heimdal libsasl2-modules-ldap libsasl2-modules-otp
#0 90.70 libsasl2-modules-sql man-browser keychain libpam-ssh monkeysphere
#0 90.70 ssh-askpass ed diffutils-doc perl-doc libterm-readline-gnu-perl
#0 90.70 | libterm-readline-perl-perl make libtap-harness-archive-perl pinentry-doc
#0 90.70 python2-doc python-tk python2.7-doc binutils binfmt-support python3-doc
#0 90.70 python3-tk python3-venv python3-setuptools python3.10-venv python3.10-doc
#0 90.70 readline-doc sqlite3-doc supervisor-doc
#0 90.82 The following NEW packages will be installed:
#0 90.82 ca-certificates curl dirmngr fontconfig-config fonts-dejavu-core git git-man
#0 90.82 gnupg gnupg-l10n gnupg-utils gosu gpg gpg-agent gpg-wks-client
#0 90.82 gpg-wks-server gpgconf gpgsm less libassuan0 libbrotli1 libbsd0 libc-dev-bin
#0 90.82 libc-devtools libc6-dev libcap2-bin libcbor0.8 libcrypt-dev libcurl3-gnutls
#0 90.82 libcurl4 libdeflate0 libedit2 liberror-perl libexpat1 libfido2-1
#0 90.82 libfontconfig1 libfreetype6 libgd3 libgdbm-compat4 libgdbm6 libjbig0
#0 90.82 libjpeg-turbo8 libjpeg8 libksba8 libldap-2.5-0 libldap-common libmd0
#0 90.82 libmpdec3 libnghttp2-14 libnpth0 libnsl-dev libpam-cap libperl5.34
#0 90.82 libpng-dev libpng-tools libpng16-16 libpsl5 libpython2-stdlib
#0 90.82 libpython2.7-minimal libpython2.7-stdlib libpython3-stdlib
#0 90.82 libpython3.10-minimal libpython3.10-stdlib libreadline8 librtmp1 libsasl2-2
#0 90.82 libsasl2-modules libsasl2-modules-db libsqlite3-0 libssh-4 libtiff5
#0 90.82 libtirpc-dev libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6
#0 90.82 libxext6 libxmuu1 libxpm4 linux-libc-dev manpages manpages-dev media-types
.........
#0 614.6 Preparing to unpack .../0-libuv1_1.43.0-1_amd64.deb ...
#0 614.7 Unpacking libuv1:amd64 (1.43.0-1) ...
#0 614.7 Selecting previously unselected package javascript-common.
#0 614.7 Preparing to unpack .../1-javascript-common_11+nmu1_all.deb ...
#0 614.7 Unpacking javascript-common (11+nmu1) ...
#0 614.7 Selecting previously unselected package libjs-highlight.js.
#0 614.7 Preparing to unpack .../2-libjs-highlight.js_9.18.5+dfsg1-1_all.deb ...
#0 614.8 Unpacking libjs-highlight.js (9.18.5+dfsg1-1) ...
#0 614.8 Selecting previously unselected package libc-ares2:amd64.
#0 614.8 Preparing to unpack .../3-libc-ares2_1.18.1-1build1_amd64.deb ...
#0 614.8 Unpacking libc-ares2:amd64 (1.18.1-1build1) ...
#0 614.9 Selecting previously unselected package libnode72:amd64.
#0 614.9 Preparing to unpack .../4-libnode72_12.22.9~dfsg-1ubuntu3_amd64.deb ...
#0 614.9 Unpacking libnode72:amd64 (12.22.9~dfsg-1ubuntu3) ...
#0 615.0 Selecting previously unselected package nodejs-doc.
#0 615.0 Preparing to unpack .../5-nodejs-doc_12.22.9~dfsg-1ubuntu3_all.deb ...
#0 615.0 Unpacking nodejs-doc (12.22.9~dfsg-1ubuntu3) ...
#0 615.1 Selecting previously unselected package nodejs.
#0 615.1 Preparing to unpack .../6-nodejs_12.22.9~dfsg-1ubuntu3_amd64.deb ...
#0 615.1 Unpacking nodejs (12.22.9~dfsg-1ubuntu3) ...
#0 615.1 Setting up javascript-common (11+nmu1) ...
#0 615.2 Setting up libc-ares2:amd64 (1.18.1-1build1) ...
#0 615.2 Setting up libuv1:amd64 (1.43.0-1) ...
#0 615.2 Setting up libjs-highlight.js (9.18.5+dfsg1-1) ...
#0 615.2 Setting up libnode72:amd64 (12.22.9~dfsg-1ubuntu3) ...
#0 615.2 Setting up nodejs-doc (12.22.9~dfsg-1ubuntu3) ...
#0 615.2 Setting up nodejs (12.22.9~dfsg-1ubuntu3) ...
#0 615.3 update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
#0 615.3 update-alternatives: warning: skip creation of /usr/share/man/man1/js.1.gz because associated file /usr/share/man/man1/nodejs.1.gz (of link group js) doesn't exist
#0 615.3 Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
#0 615.3 Processing triggers for man-db (2.10.2-1) ...
#0 615.4 /bin/sh: 1: npm: not found
anyone ever meet this problem before ? how to fix this ?
i use newer docker version and windows 11 pro.
this is first time i use laravel sail and i followed the docs in laravel website and still get the same result.
it's seems everytime i use WARP my laravel sail always failed to build, not sure if there is a change to the repo/warp itself that's started causing it.
so the best solution is disabling WARP temporary till it fix.

=> ERROR [8/9] RUN cd /var/www && composer install && npm install && npm run build in a dockerfile symfony php project

I'm new with docker, and i try to "dockerise" an existing symfony project. To begin this i've created only a Dockerfile in my symfony project that i frequently test using docker build . command.
until the part of my dockerfile where
RUN cd /var/www && \
composer install && \
npm install && \
npm run build
the command docker build . works well. But when i reach this part i obtain this error :
=> ERROR [8/9] RUN cd /var/www && composer install && npm install && npm run build 8.9s
------
> [8/9] RUN cd /var/www && composer install && npm install && npm run build:
#14 0.419 Do not run Composer as root/super user! See https://getcomposer.org/root for details
#14 0.462 Installing dependencies from lock file (including require-dev)
#14 0.462 Verifying lock file contents can be installed on current platform.
#14 0.469 Package operations: 3 installs, 0 updates, 0 removals
#14 0.470 Failed to download symfony/polyfill-mbstring from dist: The zip extension and unzip/7z commands are both missing, skipping.
#14 0.470 Your command-line PHP is using multiple ini files. Run `php --ini` to show them.
#14 0.470 Now trying to download from source
#14 0.472 - Syncing symfony/polyfill-mbstring (v1.26.0) into cache
#14 1.791 Failed to download symfony/polyfill-ctype from dist: The zip extension and unzip/7z commands are both missing, skipping.
#14 1.791 Your command-line PHP is using multiple ini files. Run `php --ini` to show them.
#14 1.791 Now trying to download from source
#14 1.791 - Syncing symfony/polyfill-ctype (v1.26.0) into cache
#14 2.467 Failed to download twig/twig from dist: The zip extension and unzip/7z commands are both missing, skipping.
#14 2.467 Your command-line PHP is using multiple ini files. Run `php --ini` to show them.
#14 2.467 Now trying to download from source
#14 2.467 - Syncing twig/twig (v3.4.1) into cache
#14 4.683 0 [>---------------------------] 0 [->--------------------------]
#14 4.684 - Installing symfony/polyfill-mbstring (v1.26.0): Cloning 9344f9cb97 from cache
#14 4.730 - Installing symfony/polyfill-ctype (v1.26.0): Cloning 6fd1b9a79f from cache
#14 4.774 - Installing twig/twig (v3.4.1): Cloning e939eae923 from cache
#14 5.154 0 [>---------------------------] 0 [->--------------------------]
#14 5.277 Generating autoload files
#14 5.278 3 packages you are using are looking for funding.
#14 5.278 Use the `composer fund` command to find out more!
#14 8.457
#14 8.457 up to date, audited 191 packages in 3s
#14 8.469
#14 8.469 13 vulnerabilities (2 moderate, 8 high, 3 critical)
#14 8.469
#14 8.469 To address issues that do not require attention, run:
#14 8.469 npm audit fix
#14 8.469
#14 8.469 To address all issues (including breaking changes), run:
#14 8.469 npm audit fix --force
#14 8.469
#14 8.469 Run `npm audit` for details.
#14 8.812 npm ERR! missing script: build
#14 8.828
#14 8.828 npm ERR! A complete log of this run can be found in:
#14 8.828 npm ERR! /root/.npm/_logs/2022-06-13T20_28_53_643Z-debug.log
------
executor failed running [/bin/sh -c cd /var/www && composer install && npm install && npm run build]: exit code: 1
I don't know if it is usefull to share all the error but i've did it if it is.
And here is my code in my Dockerfile :
FROM php:8.1-apache
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 pdo_mysql
RUN curl -sSk https://getcomposer.org/installer | php -- --disable-tls && \
mv composer.phar /usr/local/bin/composer
# install nodejs
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y nodejs \
npm
COPY . /var/www/
COPY ./docker/apache.conf /etc/apache2/sites-available/000-default.conf
RUN cd /var/www && \
composer install && \
npm install && \
npm run build
WORKDIR /var/www/
I don't know how to solve this error in order to my npm packages can be uploaded in my docker stack. I'm sorry if this question seems to be stupid but i'm not familiar with docker.
Thanks in advance to anyone who takes the time to answer my question.
edit :
after replaced npm run build by npm run watch what corresponding to the content of package.json in script the new log is :
=> ERROR [8/9] RUN cd /var/www && composer install && npm install && npm run watch 11.7s
------
> [8/9] RUN cd /var/www && composer install && npm install && npm run watch:
#14 0.871 Do not run Composer as root/super user! See https://getcomposer.org/root for details
#14 0.957 Installing dependencies from lock file (including require-dev)
#14 0.958 Verifying lock file contents can be installed on current platform.
#14 0.974 Package operations: 3 installs, 0 updates, 0 removals
#14 0.975 Failed to download symfony/polyfill-mbstring from dist: The zip extension and unzip/7z commands are both missing, skipping.
#14 0.975 Your command-line PHP is using multiple ini files. Run `php --ini` to show them.
#14 0.975 Now trying to download from source
#14 0.980 - Syncing symfony/polyfill-mbstring (v1.26.0) into cache
#14 1.768 Failed to download symfony/polyfill-ctype from dist: The zip extension and unzip/7z commands are both missing, skipping.
#14 1.768 Your command-line PHP is using multiple ini files. Run `php --ini` to show them.
#14 1.768 Now trying to download from source
#14 1.768 - Syncing symfony/polyfill-ctype (v1.26.0) into cache
#14 2.482 Failed to download twig/twig from dist: The zip extension and unzip/7z commands are both missing, skipping.
#14 2.482 Your command-line PHP is using multiple ini files. Run `php --ini` to show them.
#14 2.482 Now trying to download from source
#14 2.482 - Syncing twig/twig (v3.4.1) into cache
#14 5.854 0 [>---------------------------] 0 [->--------------------------]
#14 5.858 - Installing symfony/polyfill-mbstring (v1.26.0): Cloning 9344f9cb97 from cache
#14 5.962 - Installing symfony/polyfill-ctype (v1.26.0): Cloning 6fd1b9a79f from cache
#14 6.040 - Installing twig/twig (v3.4.1): Cloning e939eae923 from cache
#14 6.878 0 [>---------------------------] 0 [->--------------------------]
#14 7.167 Generating autoload files
#14 7.174 3 packages you are using are looking for funding.
#14 7.174 Use the `composer fund` command to find out more!
#14 10.95
#14 10.95 up to date, audited 191 packages in 3s
#14 10.98
#14 10.98 13 vulnerabilities (2 moderate, 8 high, 3 critical)
#14 10.98
#14 10.98 To address issues that do not require attention, run:
#14 10.98 npm audit fix
#14 10.98
#14 10.98 To address all issues (including breaking changes), run:
#14 10.98 npm audit fix --force
#14 10.98
#14 10.98 Run `npm audit` for details.
#14 11.51
#14 11.51 > grenier-en-ligne#1.0.0 watch
#14 11.51 > node-sass -w style -o public/style
#14 11.51
#14 11.52 /var/www/node_modules/.bin/node-sass: 1: ../node-sass/bin/node-sass: not found
#14 11.53 npm ERR! code 127
#14 11.53 npm ERR! path /var/www
#14 11.53 npm ERR! command failed
#14 11.53 npm ERR! command sh -c node-sass -w style -o public/style
#14 11.56
#14 11.56 npm ERR! A complete log of this run can be found in:
#14 11.56 npm ERR! /root/.npm/_logs/2022-06-13T21_10_42_941Z-debug.log
------
executor failed running [/bin/sh -c cd /var/www && composer install && npm install && npm run watch]: exit code: 127
NPM says "npm ERR! missing script: build"
its looks loke you have no instructions for "build" when do "npm run build"
try to check your package.json file, it may looks like this:
"scripts": {
"dev": "...",
"build": "...",
"test": "..."
},
To run
npm run build
You must have a package.json file with a
"scripts": {
"build": "...",
}
instruction in it.
Do you have the package.json file in your project? Does it have the "build" script in it?

phpize failed when building php-fpm for docker after updating mac os

I have lost the ability to build php images for docker after i've updated my mac os from 11.4 to 11.6. Before updating everything was building smoothly, but just after updating i can't seem to build php-fpm with any additional extensions at all.
So if i have Dockerfile without any extension at all the image will build
FROM php:7.4-fpm
RUN apt-get update && apt-get install -y \
curl \
wget \
git \
libfreetype6-dev \
libjpeg62-turbo-dev \
zlib1g-dev \
libpng-dev \
libonig-dev \
libzip-dev \
libmcrypt-dev \
libpq-dev
CMD ["php-fpm"]
But if i have any extension at all in my dockerfile the build will fail while trying to install the first one.
So with a dockerfile like this
FROM php:7.4-fpm
RUN apt-get update && apt-get install -y \
curl \
wget \
git \
libfreetype6-dev \
libjpeg62-turbo-dev \
zlib1g-dev \
libpng-dev \
libonig-dev \
libzip-dev \
libmcrypt-dev \
libpq-dev
RUN pecl install mcrypt-1.0.4
RUN docker-php-ext-enable mcrypt
RUN docker-php-ext-install -j$(nproc) iconv
RUN docker-php-ext-install -j$(nproc) mbstring
RUN docker-php-ext-install -j$(nproc) mysqli
RUN docker-php-ext-install -j$(nproc) pdo_mysql
RUN docker-php-ext-install -j$(nproc) zip
RUN pecl install -o redis && docker-php-ext-enable redis
CMD ["php-fpm"]
I'm getting error like this
=> ERROR [ 3/12] RUN pecl install mcrypt-1.0.4 3.7s
------
> [ 3/12] RUN pecl install mcrypt-1.0.4:
#6 3.043 downloading mcrypt-1.0.4.tgz ...
#6 3.044 Starting to download mcrypt-1.0.4.tgz (27,056 bytes)
#6 3.157 .........done: 27,056 bytes
#6 3.196 6 source files, building
#6 3.196 running: phpize
#6 3.208 Configuring for:
#6 3.208 PHP Api Version: 20190902
#6 3.208 Zend Module Api No: 20190902
#6 3.208 Zend Extension Api No: 320190902
#6 3.354 Use of uninitialized value $type in string eq at /usr/bin/autom4te line 272, <GEN0> line 66.
#6 3.354 Use of uninitialized value $type in string eq at /usr/bin/autom4te line 278, <GEN0> line 66.
#6 3.355 Use of uninitialized value $type in string eq at /usr/bin/autom4te line 284, <GEN0> line 66.
#6 3.355 Use of uninitialized value $type in concatenation (.) or string at /usr/bin/autom4te line 292, <GEN0> line 66.
#6 3.355 autom4te: /usr/share/autoconf/autom4te.cfg:66: unknown directive:
#6 3.718 ERROR: `phpize' failed
------
executor failed running [/bin/sh -c pecl install mcrypt-1.0.4]: exit code: 1
Depending on extension i'm trying to install the errors will be a little bit different
=> ERROR [3/8] RUN docker-php-ext-install -j$(nproc) iconv 4.2s
------
> [3/8] RUN docker-php-ext-install -j$(nproc) iconv:
#6 3.155 Configuring for:
#6 3.155 PHP Api Version: 20190902
#6 3.155 Zend Module Api No: 20190902
#6 3.155 Zend Extension Api No: 320190902
#6 3.769 Can't export symbol: US_GLOBAL at /usr/share/autoconf/Autom4te/FileUtils.pm line 42.
#6 3.769 BEGIN failed--compilation aborted at /usr/share/autoconf/Autom4te/FileUtils.pm line 42.
#6 3.769 Compilation failed in require at /usr/bin/autom4te line 40.
#6 3.769 BEGIN failed--compilation aborted at /usr/bin/autom4te line 40.
#6 3.772 autoheader: '/usr/bin/autom4te' failed with exit status: 255
------
executor failed running [/bin/sh -c docker-php-ext-install -j$(nproc) iconv]: exit code: 1
But still a wasn't able to find anything about these errors at all.
I've tried reinstalling developer tools and brew, but still can't build a php image with any extensions at all.
i have spent 4 days, googled like crazy, completely uninstalled my system quite a number of times, including installing a beta version of mac os 10.12 but...
...for some absolutely bizarre reason the image won't build with FROM php:7.4-fpm (though it was successfully building before) but will build with FROM php:7.4.0-fpm in Dockerfile

libc.musl-x86_64.so.1 is missing with alpine:3.7 and Apple M1

I try to install php-xdebug in docker, but I got this error
#5 7.875 ERROR: unsatisfiable constraints:
#5 7.875 php5-xdebug-2.5.5-r0:
#5 7.875 masked in: cache
#5 7.875 satisfies:
#5 7.875 world[php5-xdebug><Q1Qep6HHzf56Q7ucrPzV1CAFSr+G8=]
#5 7.875 so:libc.musl-x86_64.so.1 (missing):
#5 7.875 required by:
#5 7.875 php5-xdebug-2.5.5-r0[so:libc.musl-x86_64.so.1]
I used alpine:3.7 will Apple M1. How can I solve this problem?
Beginning of Docker file:
FROM alpine:3.7
# dependencies required for running "phpize"
ENV PHPIZE_DEPS \
autoconf \
g++ \
make \
zlib-dev
...
wget -O /root/src/php5-xdebug-2.5.5-r0.apk https://github.com/sgerrand/alpine-pkg-php5-xdebug/releases/download/2.5.5-r0/php5-xdebug-2.5.5-r0.apk && \
apk add --no-cache /root/src/php5-xdebug-2.5.5-r0.apk && \
rm /root/src/php5-xdebug-2.5.5-r0.apk && \
you may use this :
FROM alpine:3.7
RUN apk update \
&& apk upgrade \
&& apk add --no-cache php7-pear php7-dev gcc musl-dev make
RUN pecl install xdebug-2.5.5

Categories