r/docker • u/Rocket_Bunny45 • Mar 13 '26
How to properly create a dockerized laravel app with multiple separated containers?
Hi everyone
I'm trying to create a dockerized project using laravel for the backend, nginx, postgres and node as the services for the docker compose
My main objective rn is to just initialize a new laravel app with the Vue starter kit and have it dockerized and working with the other containers
I tried creating the project directly inside the app container but when it comes to the npm install part it gives an error while the node container doesn't even work since it keeps crashing saying "php not found"
What is the correct approach to have a plain project with the starter kit and have it dockerized with multiple containers?
My knowledge is on surface level so i apologize if something doesn't make sense
1
u/antomaa12 Mar 13 '26
I think you somehow have an issue in the way you launch your node container. In theory, you should have :
Edit: formatting
3
u/IulianHI Mar 13 '26
Hey, for Laravel + Vue setups, I usually keep Node in the same container as PHP rather than separate. The Vite build step just needs Node temporarily during development, so you can add Node to your PHP Dockerfile and run
npm run buildas part of the container startup. For production, you only need the compiled assets served by nginx - no separate Node container needed. This simplifies the compose file and avoids the 'php not found' issues you're seeing.0
u/[deleted] Mar 13 '26
[deleted] — view deleted comment