Truly minimal Docker images for Hugo with batteries included.
These images sets destination during build and bind when started as server, otherwise no magic.
Default minimal image based upon Busybox:
- Hugo 0.55.3:
0.55.3-busybox,busybox,0.55.3,latest,0.55.3-busybox-onbuild,0.55.3-onbuild,busybox-onbuild,onbuild(Dockerfile) - Hugo 0.55.2:
0.55.2-busybox,0.55.2,0.55.2-busybox-onbuild,0.55.2-onbuild(Dockerfile) - Hugo 0.55.1:
0.55.1-busybox,0.55.1,0.55.1-busybox-onbuild,0.55.1-onbuild(Dockerfile) - Hugo 0.55.0:
0.55.0-busybox,0.55.0,0.55.0-busybox-onbuild,0.55.0-onbuild(Dockerfile) - Hugo 0.54.0:
0.54.0-busybox,0.54.0,0.54.0-busybox-onbuild,0.54.0-onbuild(Dockerfile) - Hugo 0.53:
0.53-busybox,0.53,0.53-busybox-onbuild,0.53-onbuild, (Dockerfile)
Minimal image based upon Alpine:
- Hugo 0.55.3:
0.55.3-alpine,alpine,0.55.3-alpine-onbuild,alpine-onbuild,0.55.3-ext-alpine,ext-alpine,0.55.3-ext-alpine-onbuild,ext-alpine-onbuild,0.55.3-ext-nodejs,ext-nodejs(Dockerfile) - Hugo 0.55.2:
0.55.2-alpine,0.55.2-alpine-onbuild,0.55.2-ext-alpine,0.55.2-ext-alpine-onbuild,0.55.2-ext-nodejs(Dockerfile) - Hugo 0.55.1:
0.55.1-alpine,0.55.1-alpine-onbuild,0.55.1-ext-alpine,0.55.1-ext-alpine-onbuild,0.55.1-ext-nodejs(Dockerfile) - Hugo 0.55.0:
0.55.0-alpine,0.55.0-alpine-onbuild,0.55.0-ext-alpine,0.55.0-ext-alpine-onbuild,0.55.0-ext-nodejs(Dockerfile) - Hugo 0.54.0:
0.54.0-alpine,0.54.0-alpine-onbuild,0.54.0-ext-alpine,0.54.0-ext-alpine-onbuild,0.54.0-ext-nodejs(Dockerfile) - Hugo 0.53:
0.53-alpine,0.53-alpine-onbuild,0.53-ext-alpine,0.53-ext-alpine-onbuild(Dockerfile)
Minimal image based upon Alpine with Asciidoctor installed:
- Hugo 0.55.3:
0.55.3-asciidoctor,asciidoctor,0.55.3-asciidoctor-onbuild,asciidoctor-onbuild,0.55.3-ext-asciidoctor,ext-asciidoctor,0.55.3-ext-asciidoctor-onbuild,ext-asciidoctor-onbuild(Dockerfile) - Hugo 0.55.2:
0.55.2-asciidoctor,0.55.2-asciidoctor-onbuild,0.55.2-ext-asciidoctor,0.55.2-ext-asciidoctor-onbuild(Dockerfile) - Hugo 0.55.1:
0.55.1-asciidoctor,0.55.1-asciidoctor-onbuild,0.55.1-ext-asciidoctor,0.55.1-ext-asciidoctor-onbuild(Dockerfile) - Hugo 0.55.0:
0.55.0-asciidoctor,0.55.0-asciidoctor-onbuild,0.55.0-ext-asciidoctor,0.55.0-ext-asciidoctor-onbuild(Dockerfile) - Hugo 0.54.0:
0.54.0-asciidoctor,0.54.0-asciidoctor-onbuild,0.54.0-ext-asciidoctor,0.54.0-ext-asciidoctor-onbuild(Dockerfile) - Hugo 0.53:
0.53-asciidoctor,0.53-asciidoctor-onbuild,0.53-ext-asciidoctor,0.53-ext-asciidoctor-onbuild(Dockerfile)
Minimal image based upon Alpine with Pandoc installed:
- Hugo 0.55.3:
0.55.3-pandoc,pandoc,0.55.3-pandoc-onbuild,pandoc-onbuild,0.55.3-ext-pandoc,ext-pandoc,0.55.3-ext-pandoc-onbuild,ext-asciidoctor-onbuild(Dockerfile) - Hugo 0.55.2:
0.55.2-pandoc,0.55.2-pandoc-onbuild,0.55.2-ext-pandoc,0.55.2-ext-pandoc-onbuild(Dockerfile) - Hugo 0.55.1:
0.55.1-pandoc,0.55.1-pandoc-onbuild,0.55.1-ext-pandoc,0.55.1-ext-pandoc-onbuild(Dockerfile) - Hugo 0.55.0:
0.55.0-pandoc,0.55.0-pandoc-onbuild,0.55.0-ext-pandoc,0.55.0-ext-pandoc-onbuild(Dockerfile) - Hugo 0.54.0:
0.54.0-pandoc,0.54.0-pandoc-onbuild,0.54.0-ext-pandoc,0.54.0-ext-pandoc-onbuild(Dockerfile) - Hugo 0.53:
0.53-pandoc,0.53-pandoc-onbuild,0.53-ext-pandoc,0.53-ext-pandoc-onbuild(Dockerfile)
Image based upon Debian:
- Hugo 0.55.3:
0.55.3-debian,debian,0.55.3-debian-onbuild,debian-onbuild,0.55.3-ext,ext,latest-ext,0.55.3-ext-debian,ext-debian,0.55.3-ext-debian-onbuild,ext-debian-onbuild,0.55.3-ext-onbuild,ext-onbuild(Dockerfile) - Hugo 0.55.2:
0.55.2-debian,0.55.2-debian-onbuild,0.55.2-ext,0.55.2-ext-debian,0.55.2-ext-debian-onbuild,0.55.2-ext-onbuild(Dockerfile) - Hugo 0.55.1:
0.55.1-debian,0.55.1-debian-onbuild,0.55.1-ext,0.55.1-ext-debian,0.55.1-ext-debian-onbuild,0.55.1-ext-onbuild(Dockerfile) - Hugo 0.55.0:
0.55.0-debian,0.55.0-debian-onbuild,0.55.0-ext,0.55.0-ext-debian,0.55.0-ext-debian-onbuild,0.55.0-ext-onbuild(Dockerfile) - Hugo 0.54.0:
0.54.0-pandoc,0.54.0-pandoc-onbuild,0.54.0-ext-pandoc,0.54.0-ext-pandoc-onbuild(Dockerfile - Hugo 0.53:
0.53-debian,0.53-debian-onbuild,0.53-ext,0.53-ext-debian,0.53-ext-debian-onbuild,0.53-ext-onbuild(Dockerfile
Image based upon Ubuntu:
- Hugo 0.55.3:
0.55.3-ubuntu,ubuntu,0.55.3-ubuntu-onbuild,ubuntu-onbuild,0.55.3-ext-ubuntu,ext-ubuntu,0.55.3-ext-ubuntu-onbuild,ext-ubuntu-onbuild(Dockerfile) - Hugo 0.55.2:
0.55.2-ubuntu,0.55.2-ubuntu-onbuild,0.55.2-ext-ubuntu,0.55.2-ext-ubuntu-onbuild(Dockerfile) - Hugo 0.55.1:
0.55.1-ubuntu,0.55.1-ubuntu-onbuild,0.55.1-ext-ubuntu,0.55.1-ext-ubuntu-onbuild(Dockerfile) - Hugo 0.55.0:
0.55.0-ubuntu,0.55.0-ubuntu-onbuild,0.55.0-ext-ubuntu,0.55.0-ext-ubuntu-onbuild(Dockerfile) - Hugo 0.54.0:
0.54.0-ubuntu,0.54.0-ubuntu-onbuild,0.54.0-ext-ubuntu,0.54.0-ext-ubuntu-onbuild(Dockerfile) - Hugo 0.53:
0.53-ubuntu,0.53-ubuntu-onbuild,0.53-ext-ubuntu,0.53-ext-ubuntu-onbuild(Dockerfile)
Looking for older tags? Please see the complete list of tags.
This image does not try to do any fancy. Users may use Hugo just as they are used to.
The good practice of having a separate output folder is part of the image.
Normal build:
docker run --rm -it -v $(pwd):/src -v $(pwd)/output:/target klakegg/hugo:0.55.3
Run server:
docker run --rm -it -v $(pwd):/src -p 1313:1313 klakegg/hugo:0.55.3 server
Normal build:
build:
image: klakegg/hugo:0.55.3
volumes:
- .:/src
- ./output:/targetRun server:
server:
image: klakegg/hugo:0.55.3
command: server
volumes:
- .:/src
ports:
- 1313:1313A Hugo shell is made available in the Alpine/Debian/Ubuntu images (including Asciidoctor image). Hugo shell is bash and Hugo completion.
When Alpine images are used is bash installed as part of initiation to minimize size of Docker image.
To get into a shell for your site:
docker run --rm -it -v $(pwd):/src klakegg/hugo:0.55.3-alpine shell
Hugo as of version 0.43 contains also an extended edition.
The extended edition is used in those images containing "ext" in the name. Except use of extended edition are those images exactly the same as those using the normal edition.
Table of Hugo extention features and the version when images first support the feature:
| Feature | Alpine | Busybox | Debian | Ubuntu |
|---|---|---|---|---|
| Hugo extended | 0.43 | - | 0.43 | 0.43 |
| PostCSS | - | - | 0.43 | 0.43 |
| NodeJS/Yarn | 0.54.0 | - | 0.54.0 | 0.54.0 |
The onbuild images adds content of the folder of your Dockerfile into /src and builds to the /onbuild folder.
Example Dockerfile for your project where the site is made into an nginx image (Docker 17.05-ce or newer):
FROM klakegg/hugo:0.55.3-onbuild AS hugo
FROM nginx
COPY --from=hugo /onbuild /usr/share/nginx/htmlHugo images with Pandoc support are made available for users wanting to use Pandoc in combination with Hugo.
Hugo triggers Pandoc with pandoc --mathjax.
Some users may want to use other arguments, so to accommodate such a need is an alias pandoc created with the content of HUGO_PANDOC (default: pandoc-default) upon initiation.
The normal pandoc executable is renamed to pandoc-default to allow for later introduction of pandoc-citeproc if needed.
Example of explicit setting pandoc alias:
docker run --rm -it -v $(pwd):/src -v $(pwd)/output:/src/public -e HUGO_PANDOC="pandoc-default --strip-empty-paragraphs" klakegg/hugo:0.55.3-pandoc
Those wanting to override entrypoint in the image may easily do so.
On command line using --entrypoint:
docker run --rm -it -v $(pwd):/src -v $(pwd)/output:/src/public --entrypoint hugo klakegg/hugo:0.55.3
In docker-compose using entrypoint:
build:
image: klakegg/hugo:0.55.3
entrypoint: hugo
volumes:
- .:/src
- ./output:/src/publicEnvironment variables:
- HUGO_BIND - Bind address for server. Default:
0.0.0.0 - HUGO_DESTINATION - Location of output folder. Default:
/target - HUGO_PANDOC - Pandoc command to be triggered. Default:
pandoc-default - HUGO_ENV - Selecting environment ("DEV"/"production"). Default:
DEV
Volumes:
/src- Source folder and workdir/target- Target folder
Ports:
- 1313/tcp