Personally I use lando to run docker
https://sinnbeck.dev/posts/using-lando-to-run-laravel-in-docker
https://sinnbeck.dev/posts/getting-vite-and-laravel-to-work-with-lando
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm a fresher in docker. I tried with different methodologies but none of it succeded. 1.)Used different container for php and node. Problem: "npm run dev" require php and node in same terminal. 2.)Installed node inside php container. Problem: Ended with error module not found cli.js when running npm install. COPY --from=node:latest /usr/bin/node /usr/bin/node COPY --from=node:latest /usr/bin/npm /usr/bin/npm COPY --from=node:latest /usr/lib/node /usr/lib/node
Add this to your vite.config.js
server: {
host: '0.0.0.0',
hmr: {
host: 'localhost'
},
},
Notice: I removed https: true
https://stackoverflow.com/a/73148121
Then run
sail npm run dev
Please or to participate in this conversation.