Skip to content
Advertisement

Docker with laravel fails because of php extension

Running Laravel on an appache server.

Upon building the image with docker-compose up --build with the following Dockerfile

JavaScript

I am getting the error message:

JavaScript

This happens when the composer install command runs.

As you can see up, I am actually installing gd from php, so it should not give me this error message.

Do you have any idea how I can solve it?

Thanks!

Advertisement

Answer

It’s happen, because you are using multistage building and your composer second stage have nothing to do with previous build using PHP container. Primary use case with multistaging is to produce some useful artefacts which can be used later.

So what I suggest is to copy composer file from composer image, then place it somewhere in your php container.

I will give you my solution which is working perfectly for me with laravel/symfony etc.

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