Hugo serve not detecting changes in docker

I’m using hugo serve on the quickstart site in a pretty vanilla docker container and it doesn’t seem to be detecting changes and rebuilding. Does anyone have this working?

Windows 10 Enterprise, 19042.1645
Docker Desktop 4.8.2 with the WSL 2 backend
Docker Engine 20.10.14

To reproduce:

  1. Install Docker.
  2. Create the demo site with the quickstart guide and make a new post.
  3. Run docker run --rm -it -v ${pwd}:/src -p 1313:1313 klakegg/hugo:0.95.0-alpine shell to get a shell.
  4. Run hugo serve.
  5. Make some change to the post.

Search this forum for WSL issues:
https://discourse.gohugo.io/search?q=wsl

You might want to try hugo serve --poll 700ms, which polls for file changes instead of using kernel change notifications (which have always been a pain point for me, even on native Windows, because I also use sync programs on other directories and there are OS limits on the number of notifiers).

2 Likes

I’m running Hugo in Vagrant and this did the trick for me, thanks!

Can This Guide Help?

Run Hugo with Docker, Nginx, and Compose