-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PECL not working in php:7.4-fpm-alpine up from php:7.3-fpm-alpine due to DNS issue with pecl.php.net #1134
Comments
This seems potentially related to whatever is going on in alpinelinux/docker-alpine#149 🤔 😬 |
Great find, I just tested with php:7.4.15-fpm-alpine3.12 and that worked as normal. I edited my post above to reflect that the workaround should just be to use that specific image. Since I don't know how else this alpine image bug could manifest in a php application I would like to propose that the php alpine 3.13 images be removed or at least the default tags set to the 3.12 version that doesn't have this issue. |
Frankly I'd say this is the variant "working as designed" (unfortunately) -- see https://github.com/docker-library/docs/tree/7451c1a4c08f7f08f3fe7b8803112a9c33ecd62a/php#phpversion-alpine for a little detail, but the TLDR is that Alpine is really not an officially supported target of the PHP community, and even beyond that underlying platform differences like this are bound to continue to come up sometimes. I would further always suggest pinning your dependencies to the most specific level of risk/update you're willing to tolerate (with the ideal really being a full content-addressable digest instead of a tag, but that requires a much larger commitment in terms of effort to validate and update it over time). |
Having this issue. Profoundly annoying. Using Alpine 3.12 works for me. I agree with the solution proposed, at least until we can get a fix. I disagree it's a "working as designed" because the docs showcase |
There's definitely something environmental to this issue, because I can't reproduce on my system: $ docker pull php:7.4-fpm-alpine3.13
7.4-fpm-alpine3.13: Pulling from library/php
Digest: sha256:d405a86d94e881d61172930ad757f133412e385f908d5034e9f06c2fc2444765
Status: Image is up to date for php:7.4-fpm-alpine3.13
docker.io/library/php:7.4-fpm-alpine3.13
$ docker run -it --rm php:7.4-fpm-alpine3.13 sh
/var/www/html # apk add --no-cache $PHPIZE_DEPS
...
OK: 245 MiB in 57 packages
/var/www/html # pecl install redis
downloading redis-5.3.4.tgz ...
Starting to download redis-5.3.4.tgz (268,154 bytes)
........................................................done: 268,154 bytes
29 source files, building
running: phpize
...
configuration option "php_ini" is not set to php.ini location
You should add "extension=redis.so" to php.ini
/var/www/html # docker-php-ext-enable redis
...
/var/www/html # php -m | grep redis
redis |
@tianon I am using a brand new install of Docker for Windows v3.3.1 and Docker Engine v20.10.5. Orchestration with Debian 10 on WSL 2. |
Confirmed to get this on WSL 2 Ubuntu on Windows 11/10.. Tried this on Ubuntu Docker Engine and it works without issue. |
I'm still running into this issue using php:8.1-fpm-alpine. macOS works fine, however WSL2 fails. |
Having this issue on Manjaro with 7.4-fpm-alpine3.16 but on macOS no issues. |
I work on windows 10 on docker desktop. And the error is "connecting filed: try again" because of the default docker dns setting. You can write multiple dns addresses. Below is my laptop network setting DNS. Docker desktop -> Settings -> Docker Engine:
Dockerfile for example:
And then in the container run:
|
We could try building on Alpine 3.12 |
Alpine 3.12 has been EOL for over a year now 😬 (I don't recommend using it for anything important) |
PECL also fails for PHP 5.6.32 too. With similar error message.
|
I am not getting that error
|
After trying to use api-platform in my team, we were forced to switch to another image for now as we are facing the reported issue. https://github.com/dunglas/frankenphp/blob/main/dev-alpine.Dockerfile |
After changing from php:7.3-fpm-alpine to php:7.4-fpm-alpine, the
pecl install
command stopped working. The error given in the docker build process is:No releases available for package "pecl.php.net/redis"
forRUN pecl install redis-5.3.2
tl;dr: The problem seems to be with alpine 3.13 and not 3.12, so you can use php:7.4.15-fpm-alpine3.12.
Digging for cause
Many older resources online refer to the Great Firewall of China as the cause as this seems to be a network issue, but I'm not in China or behind any strange network setup. I dig on.
Entering the container, the following things seem problematic and related:
It makes sense that if pecl.php.net is not reachable then it
pecl install
will fail. The cause seems to be related to resolving the hostname:From here on out I'm not sure what the root cause of this problem is, but I do see a working IP address for pecl.php.net.
Proof of concept
Changing the command in the Dockerfile from:
RUN pecl install redis-5.3.3
to:
RUN echo "104.236.228.160 pecl.php.net" >> /etc/hosts && pecl install redis-5.3.3
solves the problem entirely.
This is not a sustainable fix because if the DNS for this address changes it will stop working.
Workaround
This problem does not occur on the alpine3.12-based image: php:7.4.15-fpm-alpine3.12.
Proposed solution
I suggest to recall the alpine 3.13 based images entirely and use 3.12 instead.
The text was updated successfully, but these errors were encountered: