-
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
Block the installation of Debian's PHP packages #542
Conversation
This will hopefully help folks with the confusion around installing packages like "php-apcu" and then wondering why they don't actually "work" (because they pull in Debian's PHP, and that's not what this image packages).
The suggested workaround for users who know what they're doing and are crazy enough to want two copies of PHP in their images would be to simply remove this file. |
For Google's sake, here's what this looks like when a user tries to install something that doesn't make sense in this image: root@212b2ae4fcdd:/# apt-get install php-apcu
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php-apcu is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'php-apcu' has no installation candidate
root@212b2ae4fcdd:/# apt-cache policy php-apcu
php-apcu:
Installed: (none)
Candidate: (none)
Version table:
5.1.8+4.0.11-1 -1
500 http://deb.debian.org/debian stretch/main amd64 Packages |
- `docker`: 17.12.0-ce-rc3 - `julia`: 0.6.2 - `percona`: 5.7.20 - `php`: block install of Debian `php` (docker-library/php#542) - `python`: add Alpine 3.7 variants (docker-library/python#249), update Alpine thread stack size (docker-library/python#248) - `redmine`: fix over-aggressive `chmod` (docker-library/redmine#98)
This also prevents our php-imagick from installing, which worked before :(. |
@PanMan it likely installed, but couldn't/shouldn't have been actually working with the proper PHP installation -- you likely got Debian's PHP instead, and simply didn't notice the swap You want to install |
I need to install phpunit and php5-geos in my image. What is the recommended approach to doing so now? GEOS was working for me before. Now it's causing build errors on Docker hub: farmOS/farmOS#49 |
Let's focus discussion in this new issue: #551 |
See docker-library/docs#1111 for a documentation PR which explains the reasons for the change, the intended behavior, the workaround, and the proper fix. |
This comment has been minimized.
This comment has been minimized.
library/php guys decided to break Debian PHP packages installation as per docker-library/php#542. This is a quick workaround to unblock the image build, but in the mid-run it would be better to rethink the whole image build, using alpine, pecl installs, eventually PHP7, etc. Signed-off-by: pierrecdn <me@pierre-cheynier.net>
The point for blocking the install is really clear but sorry what is not clear is the proper way that you suggest to install the different modules |
@zerho, that depends on the extension that you need. We have a whole section in the Docker Hub docs that show different ways to install extensions: https://github.com/docker-library/docs/tree/5c5113376819629b6cc856de8ae1133e4c978bf0/php#how-to-install-more-php-extensions. Those use the scripts that we provide $ docker run -it --rm php:7.2 docker-php-ext-install
usage: /usr/local/bin/docker-php-ext-install [-jN] ext-name [ext-name ...]
ie: /usr/local/bin/docker-php-ext-install gd mysqli
/usr/local/bin/docker-php-ext-install pdo pdo_mysql
/usr/local/bin/docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql shmop
if custom ./configure arguments are necessary, see docker-php-ext-configure
Possible values for ext-name:
bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo filter ftp gd gettext gmp hash iconv imap interbase intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline recode reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zend_test zip
Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded. If you can live with the version of PHP in Debian or Ubuntu so that you can just install packages like |
Yeah, the I'm currently trying to install "http" extension into the PHP and I am already 4 hours into this nightmare. |
@PeterBocan Here you go, you should add in specific versions for the packages FROM php
RUN apt-get update; \
apt-get install -y --no-install-recommends libssl-dev zlib1g-dev libcurl3-dev; \
pecl install propro raphf; \
docker-php-ext-enable propro raphf; \
apt-get purge -y --auto-remove
RUN pecl install pecl_http; \
docker-php-ext-enable http $ docker build . -t php:test
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM php
---> df1b7c730f91
Step 2/3 : RUN apt-get update; apt-get install -y --no-install-recommends libssl-dev zlib1g-dev libcurl3-dev; pecl install propro raphf; docker-php-ext-enable propro raphf; apt-get purge -y --auto-remove
---> Using cache
---> 8431c5cdaec1
Step 3/3 : RUN pecl install pecl_http; docker-php-ext-enable http
---> Using cache
---> 08796fc74ade
Successfully built 08796fc74ade
Successfully tagged php:test
$ docker run --rm php:test php -m | grep http
http |
This will hopefully help folks with the confusion around installing packages like "php-apcu" and then wondering why they don't actually "work" (because they pull in Debian's PHP, and that's not what this image packages).