You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Despite using volumes in my docker-compose.yml to map my local server folder to the container, every time I make a change in server.js, I need to rebuild the Docker container for the changes to take effect. My expectation is that changes should be immediately reflected in the running container without a rebuild, especially since I’m using nodemon to watch for file changes.
FROM node:16
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . .
CMD ["npm", "start"]
Package.json
{
"scripts": {
"start": "nodemon server.js"
}
}
Compose Version
Docker Compose version v2.29.2-desktop.2
I want changes in my server.js file (and others) to be automatically picked up by the container without needing to rebuild. How can I achieve this? Is there something wrong with my volume setup, or am I missing something else?
Docker Environment
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
This should work.
Please run docker compose exec api ls -al /app to double check file is well updated inside container after you made local change.
I wonder: don't you need to run npm in dev mode to get files reloaded ?
As an alternative to bind mount you could use the watch feature to sync ./server with container's /app on filesystem changes.
Description
I’m working on a Node.js backend project, and I’m using Docker with Docker Compose for my setup. My folder structure looks like this:
Steps To Reproduce
I’m working on a Node.js backend project, and I’m using Docker with Docker Compose for my setup. My folder structure looks like this:
Despite using volumes in my docker-compose.yml to map my local server folder to the container, every time I make a change in server.js, I need to rebuild the Docker container for the changes to take effect. My expectation is that changes should be immediately reflected in the running container without a rebuild, especially since I’m using nodemon to watch for file changes.
docker-compose.yml:
Dockerfile
Package.json
Compose Version
I want changes in my server.js file (and others) to be automatically picked up by the container without needing to rebuild. How can I achieve this? Is there something wrong with my volume setup, or am I missing something else?
Docker Environment
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: