2 ms·
What do you use to restart the app inside the container when the code changes?
by gtirloni 10y ago
What do you use to restart the app inside the container when the code changes?
- alfonsodev 10y agoI use pm2 with --watch parameter inside the container, the code is mounted, so I can edit outside, but I don't need to restart the app. I do webpack -w locally though to simplify.
- majewsky 10y agoGrandparent is referring to hot reloading, wherein the application itself recognizes changed source files and reloads them on the fly. A common feature of server-side MVC frameworks like Django, Rails, etc.
- swap32 10y agoBecause since the source code folder was not mounted on the container, we had to rebuild the image with the updated code and then restart the container. On dev machines, since the source folder is mounted, django runserver's autoreload function works as usual.
- vel0city 10y agoOften times I'll just run the container interactively with a shell and start/stop the app manually as if it was running locally while doing development work, almost as if its a super lightweight Vagrant setup. So, something like docker run -it -v /path/to/source:/app my_image /bin/bash