Skip to content
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

Add description for docker-php-ext-install #130

Merged
merged 4 commits into from
Jan 19, 2015
Merged

Add description for docker-php-ext-install #130

merged 4 commits into from
Jan 19, 2015

Conversation

AaronJan
Copy link
Contributor

Let people know there's a script so cool.

@rogeriopradoj
Copy link
Contributor

👍

1 similar comment
@salathe
Copy link

salathe commented Dec 31, 2014

👍

@thaJeztah
Copy link
Contributor

Great! Thanks

libjpeg9 libjpeg9-dbg libjpeg9-dev \
libmcrypt-dev libmcrypt4 mcrypt \
&& docker-php-ext-install gd mcrypt
CMD ["php-fpm"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be inherited from the base image, won't it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following simple example works well for me (to get both gd and mcrypt):

FROM php:5.6-fpm
RUN apt-get update && apt-get install -y \
        libpng12-dev \
        libmcrypt-dev \
    && docker-php-ext-install gd mcrypt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example is using php 5.5, which is probably more common than @tianon's example with 5.6 (since it is still quite new).

We should minimally change to php:5.5-fpm so that it does not have to be updated quite as often, rather than the 5.5.19-fpm which is already out of date.

Also, libjpeg9 (plus dev and dbg versions) does not exist in debian:jessie; it has been replaced by libjpeg62-turbo. Does it really need all those dependencies to build and later run? Can we simplify it like @tianon's example?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

I keep getting errors like 403 Forbidden [IP: 193.140.100.100 80], can't test it now.

@tianon
Copy link
Member

tianon commented Dec 31, 2014

Other than my two nits, generally LGTM 👍

@tianon
Copy link
Member

tianon commented Dec 31, 2014

Oh, and please use git commit --amend and git push -f to your branch instead of opening a new PR -- this one will update automatically when you do that. 👍

@AaronJan
Copy link
Contributor Author

AaronJan commented Jan 6, 2015

Updated. : )
Is this version good?


For example, if you want to have a PHP-FPM image with `gd` and `mcrypt`
extensions, you can inheriting the base image that you like, and write your own
Dockerfile like this:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, Dockerfile should be in backticks too. 👍

@AaronJan
Copy link
Contributor Author

Updated. : )

@schmunk42
Copy link

Why doesn't the script docker-php-ext-install install the required packages? We would only have to collect the deps once and put them into the script.

@tianon
Copy link
Member

tianon commented Jan 12, 2015

"only"

We'd have to collect the dependencies of every module in the PHP core, which is not a small list: (Possible values for ext-name:)

$ docker run -it --rm php:5.6 docker-php-ext-install
usage: /usr/local/bin/docker-php-ext-install ext-name [ext-name ...]
   ie: /usr/local/bin/docker-php-ext-install gd mysqli
       /usr/local/bin/docker-php-ext-install pdo pdo_mysql

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 mcrypt mssql mysql 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 spl standard sybase_ct sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zip

@schmunk42
Copy link

But every developer has to look up the deps manually or did I miss something here. How do you know which packages to install first?

@tianon
Copy link
Member

tianon commented Jan 12, 2015

I usually just try it. When it complains about a header file (like, png.h for example), I search for that on https://packages.debian.org (ie, https://packages.debian.org/file:png.h, from which I find that libpng12-dev is the likely candidate, which means that libpng12 is probably necessary at runtime too, but it's worth double-checking that by removing libpng12-dev afterwards and then running the image -- if I get errors about libpng missing, I clearly need the runtime library too).

There's not an existing reference of every module's required packages that I'm aware of, and as you can see, it would be fairly tedious to create and would have quite the potential for getting outdated since we have such a large surface area, so I wouldn't be comfortable with such a list unless it also came with a nice way to verify that the list is still current and accurate (including whether the modules referenced still do require the packages we think they do).

@schmunk42
Copy link

I totally agree with you that the list needs to be maintained and for sure this is some work to do.

But all the things you mentioned are a reason to maintain such a list, everyone has to find out what works over and over again, especially when there are updates, IMHO.

At the moment, to be honest, this keeps me a away from using this image (which I'd really like to do) - but it's much more to work to try and error with the dependencies and build over and over again, than just running apt-get install php5-foobar on a debian image, which is much more error prone for me.

@tianon
Copy link
Member

tianon commented Jan 12, 2015

If someone is willing to maintain such a list, then by all means, please step up. I'm not opposed to such a list if it has a dedicated maintainer who's willing to constantly update it will all possible permutations.

@AaronJan
Copy link
Contributor Author

Intresting, this list could be really useful.

Is there any one?

@AaronJan
Copy link
Contributor Author

I solved my problem, never mind..
To enable jpeg, freetype in GD must use the docker-php-ext-configure script.

I just saw the notes you guy added 3 days ago, now I'm trying to make this Dockerfile shorter.

@yosifkit
Copy link
Member

LGTM

@tianon
Copy link
Member

tianon commented Jan 19, 2015

Awesome, thanks! LGTM

tianon added a commit that referenced this pull request Jan 19, 2015
Add description for `docker-php-ext-install`
@tianon tianon merged commit 863f3c8 into docker-library:master Jan 19, 2015
@thaJeztah
Copy link
Contributor

Thanks!

ypid pushed a commit to ypid/docker-docs that referenced this pull request May 23, 2016
Updated apt_cacher_ng, apt_preferences and cryptsetup roles.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants