Newbie: Running hugo in a container on ubuntu

I toyed with Hugo (with docsy) about a year ago and have come back to look at it. docsy has moved on to a later version as has Hugo.

Previously I used klakegg/hugo but this is now too old for the docsy and Hugo versions I need… so I have moved to… hugomods/hugo

My site has been git inited and all the files are owned by me (a non-root user) on Ubuntu

When I run the container I get…

ERROR Failed to read Git log: fatal: detected dubious ownership in repository at ‘/src’
To add an exception for this directory, call:

    git config --global --add /src

Now I presume this is because the uid of the container is not me so when the container tries to do git commands it finds a mismatch in ownership. Is there a way around that?

I liked this way of working… my directory was SAMBA shared so I could edit the underlying files on windows.

I suggest you take this up with dockerfile owner.

I always include this in the dockerfile:

# Configure Git
RUN git config --system --add /WHATEVER && \
    git config --system --add core.quotepath false
1 Like

So that would be the author at hugomods/hugo?

Is there a way for me to mixin the extra commands?

(Not a docker expert)


Roll your own dockerfile.

I think this brings us back to…

I created a


FROM hugomods/hugo

# Configure Git
RUN git config --system --add /src && \
    git config --system --add core.quotepath false

CMD hugo server -D --baseURL "" --bind

and did a

docker build -t hugo-app .

and created a


version: "3.3"


    image: hugo-app
      context: .
      - "1313:1313"
      - .:/src

and then did a

docker compose -d up

And now I seem to have a served site. Hopefully this information will prove useful to someone asking the question in future.

1 Like

cc @razon

1 Like

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