Public | Automated Build

Last pushed: 2 months ago
Short Description
Base image for Hugo - a fast and modern static website engine.
Full Description



This is a base image for working with Hugo - a fast and modern static website engine. It can either be used to run arbitrary Hugo commands for your project or as a base image for your custom container.

The default entrypoint runs the plain hugocommand. Via command parameters the command which should be used to run Hugo can be selected and parameterized. For example running docker run ... fbrx/hugo server -D -F will result in running hugo server -D -F inside the container.


As a "on demand" Hugo runtime

The image can be used to run Hugo commands for your project. Since the container needs the Hugo site data available, the correct folder has to be supplied in the docker runcommand via the -v parameter to be mounted at /site.

See Volumes for an example and further detail.

As a base image for your custom container

When used as a base image, the image expects to be build from a Hugo project root. Meaning you should have a folder structure as follows when building a container:

|-- archetypes/
|-- content/
|-- layouts/
|-- public/
|-- static/
|-- themes/
|-- config.toml
|-- Dockerfile

A sample Dockerfile may look like follows:

FROM fbrx/hugo

# customizes the default command when the container is run. The arguments will be supplied to the hugo command.
CMD ["server", "-b", "myhost"]


Entrypoint and CMD

The default entrypoint of the image performs the following steps:

  1. clean the /site/public directory
  2. run the hugo command with all arguments supplied via the CMD instruction (either via Dockerfile or arguments to docker run)

The default will just call hugo without any arguments which will just rebuild your site.


When run, the image expects a Hugo site structure at /site. When used as a base image, the contents of the current folder will be added to this folder.

When the image is used "standalone", the folder which should be used has to be specified via the -v flag to the docker run command.

Example to use the current directory: docker run --rm -p 1313:1313 -v ${PWD}:/site fbrx/hugo


When the image is used to run your site via hugo server in conjunction with boot2docker, you have to supply the IP or hostname of your boot2docker host as the baseUrl to the hugo command.

Example: docker run --rm -p 1313:1313 -v ${PWD}:/site fbrx/hugo server -b

The IP of the boot2docker host can be obtained by simply running boot2docker ip.

Docker Pull Command
Source Repository

Comments (0)