Help installing hugo in a docker container with portainer

I’m using portainer to manage my containers and I am trying to install hugo.

I created a stack with this configuration:

version: '3'
services:
  build:
    image: hugomods/hugo:latest
    container_name: hugo_build
    volumes:
      - "/home/pi/hugo:/src"

  server:
    image: hugomods/hugo:latest
    container_name: hugo
    restart: always
    command: server --watch --bind 0.0.0.0
    ports:
      - "1313:1313"
    volumes:
      - "/home/pi/hugo:/src"

The hugo_build container exits and in the logs it only says:

hugo v0.128.0-e6d2712ee062321dc2fc49e963597dd5a6157660+extended linux/arm64 BuildDate=2024-06-25T16:15:48Z

GOOS="linux"
GOARCH="arm64"
GOVERSION="go1.22.4"
github.com/sass/libsass="3.6.5"
github.com/webmproject/libwebp="v1.3.2"

the hugo container is running but the logs show this error

node:internal/modules/cjs/loader:1215

  throw err;
  ^
Error: Cannot find module '/src/server'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1212:15)
    at Module._load (node:internal/modules/cjs/loader:1038:27)
    at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:5)
    at node:internal/main/run_main_module:30:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
Node.js v22.3.0

Replace server with hugo server should work.

Since there is no alias command mapping from server to hugo server like klakegg/hugo does.

Thank you, it worked!

I added server command for latest hugomods/hugo images, an alias for hugo server that bind 0.0.0.0 by default, re-pull may be required.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.