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

rileys-cr's avatar

Laravel Sail Install Package With Apt

I want to be able to install a package using apt into the Sail container

eg sudo apt update && sudo apt install libxrender1.

I know I can add a line to to the Sail Dockerfile, but that would be overwritten every time that package updates.

My current work around is to run every time I start Sail:

docker exec -u root {container_name} apt update
docker exec -u root {container_name} apt install libxrender1

Is there I can run a custom shell command every time I run sail up?

0 likes
2 replies
rileys-cr's avatar

Does anyone have experience customizing Sail in this way?

richienabuk's avatar
Level 1

@rileys-cr laravel.com/docs/11.x/sail#sail-customization

sail artisan sail:publish

Publish the docker file and add your custom command to load each build time.

Please or to participate in this conversation.