hugomods / docker

:whale: The automated, up-to-date and minimal third party Hugo Docker Images. 自动化、最新和最小化的第三方 Hugo Docker 映像。
https://docker.hugomods.com
MIT License
63 stars 8 forks source link

Running as a server no longer works #63

Closed j-maynard closed 11 months ago

j-maynard commented 11 months ago

Running the Docker image in server mode no longer works. The Docs say to run in server mode like so:

docker run -p 8080:8080 \
  -v ${PWD}:/src \
  hugomods/hugo \
  hugo server --bind 0.0.0.0 -p 8080

However this just results in hugo building the site and not running the server. Tested using docker desktop on a Mac. A screenshot also helps.

image
razonyang commented 11 months ago

However this just results in hugo building the site and not running the server.

Could you please provide the full log? Both of hugo and hugo server will produce the following similar information, but I didn't find it from your screenshot. If the screenshot already includes all information, it seems the process was terminated, still processing or sth else.

image

razonyang commented 11 months ago

I couldn't reproduce it by using the same Docker image, please let me know if there is any additional information I missed.

image

linux/arm64

image

razonyang commented 11 months ago

I'm closing this as per no further information, please comment below if there any additional information.

j-maynard commented 11 months ago

Sorry I've been on Holiday for the Christmas period and I've just got back. here's the output of both commands:

image

Additional information... Docker Desktop for Mac (official client) running on an Apple M1 (So ARM64)

razonyang commented 11 months ago

Hi @j-maynard, according to the screenshot you provided above, the ... hugo server ... does't finish yet, it should produce similar info as the second command, or display some errors, I guess the process comsumed too many memory and was terminated by OS.

I can reproduce it with limited ram for container, as the image below shown, the process was killed by OS without errors in stdout.

image

Gif:

peek2

You can check the system/memory log or sth similar, /var/log/kern.log for Linux (Ubuntu), I don't know how on macOS, please google yourself.

Back to the issue, if it's an out of memory issue, I don't have a solution for this except adding more RAM. you can either adding more RAM or specifying the --renderToDisk flag.

j-maynard commented 10 months ago

You were right it was a memory issue in part because of the way server runs and the sheer size of the GitLab Handbook. Hugo unhelpfully doesn't tell us when it runs out of memory or exits with a non-zero exit code. Changing things so that it use --renderToDisk massively reduces the memory footprint though at the expense of performance.

Thank you for your help with this... I can share this with my team.