Skip to content
Advertisement

Dockerfile: error: ‘docker-php-ext-install’ does not exist and extension does not exist

I’m trying to install some PHP extensions when building a php-apache image. Here’s the ./php/Dockerfile:

JavaScript

And here’s the docker-compose.yml:

JavaScript

And when I run docker-compose up -d, this is the error given to me:

JavaScript

What is wrong in here?

I tried to use all absolute paths like this:

JavaScript

But then it gives me errors like these:

JavaScript

Not sure what I’m doing wrong here?

Advertisement

Answer

You are missing && at the end of each line of the long RUN command in the Dockerfile, before .

JavaScript

Also, extensions should be enabled by default, there is no need to run docker-php-ext-enable, at least with the PHP-FPM images.

One more thing, even with these modifications, your build will likely fail because of missing dependencies and/or unknown extensions (if some are already in the base image).

For instance, gd will need zlib, so you must install these dependencies before installing the extensions (apt update && apt install -y ...).

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement