The smallest hugo image built from Alpine.
docker pull yanqd0/hugo
There are two simple ways to use the image when developing,
docker run or
As the help of
hugo server says:
Hugo provides its own webserver which builds and serves the site. While hugo server is high performance, it is a webserver with limited options. Many run it in production, but the standard behavior is for people to use it in development and use a more full featured server such as Nginx or Caddy.
hugo serverwill avoid writing the rendered and served content to disk, preferring to store it in memory.
The default command of this docker image is
When generating the
public directory in the production environment,
please specify the command to
docker run --rm -v $PWD:/srv/hugo yanqd0/hugo hugo
If the current directory is not the hugo project, you can replace
$PWD with the path.
It may not be a convenient way to use
docker run in the development environment.
I prefer to use a docker-compose.yml file.
You can write a
docker-compose.yml in your hugo project like this:
version: '3' services: hugo: image: yanqd0/hugo volumes: - .:/srv/hugo ports: - 1313:1313
docker-compose up -d, then a hugo server with many arguments in the port 1313 is serving.
There is a verified docker-compose.yml for example.
It is welcome to remind me about updates by issues.
I use the official releases instead of compiling from source, so the image is very small.
The image will update with hugo releases. I will try to change less.
Since the tag
root user is used to generate sites.
Before that, a
hugo user with the pid
1000 is used,
which will cause a permission problem when generating a
In fact, a user in the group
docker can also have the
root permission inside the container.
hugo server should not be used in a production environment,
so it is unnecessary to use a non-root user to ensure safety.
Since the tag ‘0.30’, a executable
git is added to this image.
Some functions needs
Copyright (c) 2017~2020 Yan QiDong email@example.com