Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

noop's avatar
Level 5

How to install add php extension to install sail on existing project

In laravel documentation we have the following code ‘’’ docker run --rm -v $(pwd):/opt -w /opt laravelsail/php80-composer:latest composer install’’’

We can use this to install sail in a existing project if we dont have composer and php in the local environment. I’m facing an issue I need to add some extensions like ext-gd because some extension in my composer requires this. There are any way to tweak the command to install that php extensions?

0 likes
3 replies
neilstee's avatar

@noop you can edit the docker/8.0/Dockerfile file and add this:

RUN apt-get install -y php8.0-gd

Save it and then run ./vendor/bin/sail build and ./vendor/bin/sail up -d

komeil's avatar

generally if you wanna change the container , whether it is adding extension or installing some OS level package or . . . , you need to first publish the dockerFile with

sail artisan sail:publish

then make your desired changes and after that rebuild the container with sail bulid

1 like
j_hnny's avatar

Ideally, there should be a way to configure additional extensions without forking via sail artisan sail:publish.

2 likes

Please or to participate in this conversation.