laravel sail always error when doing "sail up" - php

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.

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.

invalid package name/package file "docker-php-ext-configure" (Apple silicon)

Can't build up my project on my new laptop (macbook m1). It was built great on my previous machine with Intel.
Here's the part of my Dockerfile
FROM php:7.4-apache
ENV COMPOSER_ALLOW_SUPERUSER 1
ARG GOLANG_VERSION=1.16.5
RUN apt-get update && apt-get install -y \
cron \
curl \
wget \
git \
libfreetype6-dev \
libzip-dev \
libonig-dev \
libxslt-dev \
libicu-dev \
libmcrypt-dev \
libxml2-dev \
libsodium-dev \
libpq-dev \
zlib1g-dev \
libpcre3-dev \
libcurl4-openssl-dev \
libmagickwand-dev --no-install-recommends \
pkg-config \
libssl-dev \
&& a2enmod \
rewrite \
&& pecl install \
imagick \
RUN docker-php-ext-configure \
gd \
pgsql -with-pgsql=/usr/local/pgsql \
exif \
&& docker-php-ext-install \
gd \
mysqli \
pdo \
pdo_pgsql \
pgsql \
sockets \
zip \
mbstring \
xml \
intl \
curl \
exif \
&& docker-php-ext-enable \
imagick \
exif
Here's the part of docker-compose.yaml
version: '3.1'
services:
web:
build: ./docker/web
env_file:
- .env
environment:
- APACHE_RUN_USER=#1000
volumes:
- ${WEB_ROOT_PATH}:/var/www/html/
ports:
- ${WEB_PORT}:80
working_dir: ${WEB_WORKING_DIR}
restart: unless-stopped
Then I do docker-compose up --build -d and after 400 seconds of waiting here's what I got:
#0 106.6 Processing triggers for mailcap (3.69) ...
#0 106.6 Processing triggers for libglib2.0-0:arm64 (2.66.8-1) ...
#0 106.6 No schema files found: doing nothing.
#0 106.6 Processing triggers for libc-bin (2.31-13+deb11u4) ...
#0 106.6 Setting up libcairo2-dev:arm64 (1.16.0-5) ...
#0 106.7 Setting up libgdk-pixbuf-2.0-dev:arm64 (2.42.2+dfsg-1+deb11u1) ...
#0 106.7 Setting up librsvg2-dev:arm64 (2.50.3+dfsg-1) ...
#0 106.7 Setting up libmagickcore-6.q16-dev:arm64 (8:6.9.11.60+dfsg-1.3) ...
#0 106.7 Setting up libmagickwand-6.q16-dev:arm64 (8:6.9.11.60+dfsg-1.3) ...
#0 106.7 Setting up libmagickwand-dev (8:6.9.11.60+dfsg-1.3) ...
#0 106.7 Processing triggers for libgdk-pixbuf-2.0-0:arm64 (2.42.2+dfsg-1+deb11u1) ...
#0 106.8 Enabling module rewrite.
#0 106.8 To activate the new configuration, you need to run:
#0 106.8 service apache2 restart
#0 169.3 No releases available for package "pecl.php.net/imagick"
#0 229.3 No releases available for package "pecl.php.net/RUN"
#0 289.4 No releases available for package "pecl.php.net/gd"
#0 349.5 No releases available for package "pecl.php.net/pgsql"
#0 409.6 No releases available for package "pecl.php.net/exif"
#0 409.6 parsePackageName(): only one version/state delimiter "-" is allowed in "docker-php-ext-configure"
#0 409.6 invalid package name/package file "docker-php-ext-configure"
#0 409.6 Attempting to discover channel "-with-pgsql=/usr/local"...
#0 409.6 Attempting fallback to https instead of http on channel "-with-pgsql=/usr/local"...
#0 409.6 unknown channel "-with-pgsql=/usr/local" in "-with-pgsql=/usr/local/pgsql"
#0 409.6 invalid package name/package file "-with-pgsql=/usr/local/pgsql"
#0 409.6 install failed
------
failed to solve: executor failed running [/bin/sh -c apt-get update && apt-get install -y cron curl wget git libfreetype6-dev libzip-dev libonig-dev libxslt-dev libicu-dev libmcrypt-dev libxml2-dev libsodium-dev libpq-dev zlib1g-dev libpcre3-dev libcurl4-openssl-dev libmagickwand-dev --no-install-recommends pkg-config libssl-dev && a2enmod rewrite && pecl install imagick RUN docker-php-ext-configure gd pgsql -with-pgsql=/usr/local/pgsql exif && docker-php-ext-install gd mysqli pdo pdo_pgsql pgsql sockets zip mbstring xml intl curl exif && docker-php-ext-enable imagick exif]: exit code: 1
I don't really know what's wrong here, I just tried to do the same on my previous machine and it was built fine.
pgsql -with-pgsql=/usr/local/pgsql
i guess it should be
pgsql --with-pgsql=/usr/local/pgsql
So my problem was solved by itself and all containers were built when I turn on VPN.
I don't really know why it works like this but it wasn't be possible to download packages from pecl without using VPN.

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

Docker: E: Unable to locate package mysql-client —-no-install-recommends

I'm following this tutorial: Laravel 5.6 in Docker with PHP 7.2, NGINX 1.10 and MySQL 5.7
Which is basically an update of this: Laravel + Docker Part 1 — setup for Development
But when I ran
docker-compose up
I got this error
E: Unable to locate package mysql-client —-no-install-recommends
ERROR: Service 'app' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y mysql-client —-no-install-recommends && docker-php-ext-install pdo_mysql' returned a non-zero code: 100
A full output
Creating network "pulzu_default" with the default driver
Building app
Step 1/2 : FROM php:7.2.2-fpm
---> 60245f64ed12
Step 2/2 : RUN apt-get update && apt-get install -y mysql-client —-no-install-recommends && docker-php-ext-install pdo_mysql
---> Running in cefd70564b31
Get:1 http://security.debian.org stretch/updates InRelease [94.3 kB]
Ign:2 http://cdn-fastly.deb.debian.org/debian stretch InRelease
Get:3 http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:5 http://security.debian.org stretch/updates/main amd64 Packages [468 kB]
Get:4 http://cdn-fastly.deb.debian.org/debian stretch Release [118 kB]
Get:6 http://cdn-fastly.deb.debian.org/debian stretch Release.gpg [2434 B]
Get:7 http://cdn-fastly.deb.debian.org/debian stretch-updates/main amd64 Packages [12.1 kB]
Get:8 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 Packages [9530 kB]
Fetched 10.3 MB in 2s (4142 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package mysql-client —-no-install-recommends
ERROR: Service 'app' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y mysql-client —-no-install-recommends && docker-php-ext-install pdo_mysql' returned a non-zero code: 100
Does anyone have any idea how to fix it?
The image is missing dependencies to be able to install mysql-client, this is caused by the --no-install-recommends flag. By default, Ubuntu installs recommended but not suggested packages. With --no-install-recommends, only the main dependencies (packages in the Depends field) are installed.
Change the Dockerfile or according to the article app.dockerfile to:
FROM php:7.2.2-fpm
RUN apt-get update && apt-get install -y mysql-client \
&& docker-php-ext-install pdo_mysql
And you should be able to build the image, therefore the docker-compose up command would work.

Categories