I’ve used Hugo for my blog for several years now, and it’s great. One of the things I love about it is the fast build time coupled with it’s live-reload feature. Using this I can edit my source (Markdown or Asciidoc) in one window, hit save, and see the preview update in my browser window next to it pretty much instantaneously. For copy-editing, experimenting with images, etc this is really helpful.
😠But then it stopped working.
🤔 Running Hugo on my M1 MacBookPro it would build and serve the site locally, but if I changed a file it wouldn’t get detected, let alone re-built.
Various Google hits were either old, irrelevant, or dead-ends. And then I thought…what else has changed?
💡 Docker. Or rather, not Docker.
I run Hugo with Docker because it’s self-contained, reproducable, portable, and all those good things:
docker run --rm -it \
-v $(pwd):/src \
-p 1313:1313 \
rmoff-blog-hugo:0.152.2 \
server --buildFuture --buildDrafts --bind 0.0.0.0
Note: The blog now uses Hugo 0.152.2 with a custom Docker image. See the README for how to build it.
And the one thing that had changed was that I’d moved from running Docker Desktop to Orbstack. Until now I’d not noticed a single difference—it’s the same docker CLI commands as before, it’s just not Docker Desktop.
👉 Switching back to Docker Desktop and re-running Hugo resolved the issue. My changes are now being detected automagically and rebuilt:
Change detected, rebuilding site.
2023-11-16 16:33:59.561 +0000
Source changed WRITE "/src/content/post/lafs01e05.md"
Total in 163 ms
I found this issue but it says it’s fixed in OrbStack 0.8, and I’m running 1.1.0. This issue is more recent but not directly relevant from what I can see.
💡 I’ve logged this issue: Hugo does not detect changed files when run under OrbStack; works fine with Docker Desktop #797
