Ask Your Question
1

Why is Nodemon syncing but not restarting in Docker?

asked 2022-01-05 11:00:00 +0000

ladyg gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-11-18 18:00:00 +0000

lalupa gravatar image

There could be several reasons for this. Here are some possible causes:

  1. Nodemon is not installed inside the Docker container: Check if Nodemon is installed correctly inside the Docker container. If not, then install it using the command npm install -g nodemon.

  2. Nodemon is not watching files: Check if Nodemon is watching the correct files. If not, then add the correct files or directories that Nodemon should be watching. You can do this by adding the --watch flag followed by the file or directory path.

  3. Nodemon is not listening for changes: Check if Nodemon is listening for file changes. If not, then add the --exec flag followed by the command that should be executed when a file changes. For example, if you want to run node server.js when a file changes, then add the command nodemon --watch . --exec "node server.js".

  4. Nodemon is not running in the foreground: Check if Nodemon is running in the foreground. If not, then add the -L flag to force Nodemon to run in the foreground.

  5. Docker volume permissions: If you are using volumes to sync your local files to the Docker container, then the permissions on those files can cause issues. Make sure the ownership and permissions are set correctly on the files inside the container.

  6. Docker container settings: Check if the Docker container settings are allowing Nodemon to restart. If the container is set to restart always, then Nodemon should restart after file changes. If not, then change the container settings to restart always.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-01-05 11:00:00 +0000

Seen: 16 times

Last updated: Nov 18 '22