Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Nodemon not restarting in docker #1447
version: '3.1' services: node: image: node:10 working_dir: /usr/local/src/ volumes: - .:/usr/local/src/ environment: - NODE_ENV=development command: bash -c "nodemon --watch src --exec 'node src/server.js'"
Should restart when I change a file in
Does not restart
Steps to reproduce
If I add the
@remy this appears to be a symptom of a nodemon change. After upgrading, we had to follow https://github.com/remy/nodemon#application-isnt-restarting to make it work in docker.
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up.
I've managed to spend more than a day debugging this problem so let me help provide my learnings.
For some context, I have an extra step in my build process. I have
Through quite a bit of investigation I started to notice that while nodemon was not restarting, the updated build files were successfully being picked up within the container itself.
A further insight revealed that if I manually changed a file from within the container, nodemon restarted as expected.
With this I then attempted to just run my watch system from the container itself and voila, I had nodemon restarted following local changes again!
To be perfectly honest I don't know exactly why changing the execution context of the file changes matters.
I attempted to revert the commits of the last few versions of nodemon to see if that fixed the original problem and still saw no change in behavior.
My hunch is that a dependency of nodemon that handles the fs watch has broken the existing functionality. Somehow in the execution path of mac os file change -> container volume symlink change is not being picked up by nodemon.
Considering I don't know enough about nodemon's internals and I have a working environment again, i've not looked further into trying to figure out what dependency might be to blame here.