Check if it is exposed by running docker ps
Personally I expose the port, start the container with docker compose, and finally uses docker-compose exec to run the command in the running container
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello! I created a docker compose configuration to serve my application.
(I know about Sail, but I wanted to make basic configuration by myself to learn Docker better)
I add node as container:
node:
container_name: node
image: node:lts
working_dir: /var/www
volumes:
- ./:/var/www
ports:
- 5173:5173
And added tailwind to my assets. But I can't get npm run dev to working. I start it like that:
docker compose run --rm node npm run dev
Vite sees file changes and reload it
3:15:52 PM [vite] page reload resources/views/welcome.blade.php (x2)
But it has no effect on my assets when I change tailwind classes in the *.blade.php files. Like there is no Tailwind at all. npm run build works as expected.
There are errors in console:
GET http://127.0.0.1:5173/@vite/client net::ERR_CONNECTION_REFUSED
GET http://127.0.0.1:5173/resources/css/app.css net::ERR_CONNECTION_REFUSED
It seems that I should somehow expose vite from node container to application, but how do I do it?
Thank you
Check if it is exposed by running docker ps
Personally I expose the port, start the container with docker compose, and finally uses docker-compose exec to run the command in the running container
Please or to participate in this conversation.