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

TuffRivers's avatar

Basic Docker & Laravel Question

Hi All, I am learning docker. from what i understand, when you mount a volume, it eclipses the specified mounted directory in the container (this case would be our application code files for laravel). What is the best way to handle my vendor and node_modules folders so they are available at run time? Right now i see them in the build phase but obviously they arent available whent he container is running as the mounted volume from my local computer overwrites the container files.

Should I

  1. manually run composer installa nd npm install after the container is built and remove the install commands from the dockerfile?
  2. Situate the vendor and node_modules OUTSIDE of my mounted directory (so they are not over ridden) - i would need to change the paths that laravle uses to find these folders.

What does everyone else do to handle this situation?

0 likes
1 reply

Please or to participate in this conversation.