klakegg / docker-hugo

Truly minimal Docker images for Hugo open-source static site generator.
https://hub.docker.com/r/klakegg/hugo/
MIT License
390 stars 68 forks source link

more doc needed #3

Closed babatundebusari closed 5 years ago

babatundebusari commented 5 years ago

After running this command

docker run --rm -it -v $(pwd):/src -v $(pwd)/output:/target klakegg/hugo:0.46

got below error

Error: Unable to locate Config file. Perhaps you need to create a new site.
       Run `hugo help new` for details.

i am not sure if the /src folder mounted from host need files there already i am just looking to get started with hugo with docker and not sure if there are needed files or pre-requisites before running the docker commands in the README file

Will be great if you can add some more info in readme for people getting started with hugo with docker

klakegg commented 5 years ago

This project makes Hugo as Docker image and is not a replacement of Hugo. Please see the Hugo documentation for information on how to use Hugo.

babatundebusari commented 5 years ago

Just because it is dockerized hugo does not mean you can not have a proper documentation of how to use the image. Just trying to help you maintain a helpful repo but you can do whatever you want; it is your repo!. Peace.

yanboyang713 commented 3 years ago

@babatundebusari Any ideas for when you start up Hugo within docker, after run "hugo new site" automatically? Thanks

h3rb1n4t0r commented 2 years ago

Am also interested in getting this one right :)

beckitrue commented 2 years ago

I just worked my way through this issue. The Docker image has hugo installed, but it doesn't have any code for a website. That's why we get the error about missing a config file. This page helped me work out that bit. If you do have code for a website, make sure your $(pwd) is the directory containing your site's code.

If you don't have code for a website on your local machine, you can start the container with the shell command like so (if your them uses mods, choose a ext-<os>-onbuild image):

docker run --rm -it \
  -v $(pwd):/src \
  klakegg/hugo:0.93.2-alpine \
  shell

Then, from the container's shell, you can clone your website's GitHub repo (git is installed), or if you're starting from scratch, do a Quick Start and build your site.

You can start the server when you're done hugo server -D. The -D shows you draft posts.