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

Alpine packages do not seem compatible with built php #672

Closed
chrissound opened this issue Jun 20, 2018 · 2 comments
Closed

Alpine packages do not seem compatible with built php #672

chrissound opened this issue Jun 20, 2018 · 2 comments

Comments

@chrissound
Copy link

I had the following dockerfile:

FROM php:7.2-fpm-alpine3.7
RUN apk add --update php7-gd
...

However when running this, it complained it couldn't find the php-gd extension. I then instead changed the dockerfile to:

FROM alpine:3.7

RUN apk add --update --no-cache php7 php7-gd

Which then worked. So I'm guessing it's do with the way php is built. None the less I find this behavior a bit intuitive. What is the purpose on basing the image on alpine in this case?

@tianon
Copy link
Member

tianon commented Jun 20, 2018

When you install php* packages via apk, you're installing Alpine's PHP package (and thus if you're FROM php:xxx, you've got two copies of PHP included in the image). This image provides PHP in the way that PHP upstream recommends and supports, which is downloaded and built from source. If you want to continue using this PHP image, you'll need to download and compile modules like gd from source as well. For modules which are built-in (like gd), you can use the helper scripts we provide to do so (docker-php-ext-install, etc).

See the section titled "How to install more PHP extensions" on https://hub.docker.com/_/php/ (https://github.com/docker-library/docs/blob/7aeed6ad70a0ccdce57d42e4a152fa0dfbedbbc4/php/README.md#how-to-install-more-php-extensions).

@tianon tianon closed this as completed Jun 20, 2018
@chrissound
Copy link
Author

Sorry I guess this isn't really an issue so I've asked the question here instead: https://stackoverflow.com/questions/50964997/why-do-the-official-docker-images-build-its-software-from-source-rather-than-fr

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

No branches or pull requests

2 participants