Enabling Live Reload in a Docker Container

When we use the term “live reload,” what we really mean is that we want to be able to change our source code, save, and see that change live without having to stop or restart a container.

To achieve this, there are a few things that need to happen:

Your updated code needs to be in the container. The easiest way to do this is using Docker volume mounting.

You need a tool to watch for code changes to restart your application if a file changes. Support for live reloading is dependent on the programming language and platform you are using. For Node, you can use NPM package nodemon, for Go, you can use the Gin utility https://github.com/codegangsta/gin to recompile when code changes, and for ASP.NET, ...

Get Microservices with Docker on Microsoft Azure™ (includes Content Update Program) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.