I'm having problems running Hugo extended edition in Docker independent of base image.
Minimal Dockerfile for standard edition running just fine:
FROM busybox:1.28
ADD https://github.com/gohugoio/hugo/releases/download/v0.43/hugo_0.43_Linux-64bit.tar.gz /hugo.tar.gz
RUN tar -zxvf hugo.tar.gz
RUN ["/hugo", "version"]
Minimal Dockerfile for extended edition resulting in error:
FROM busybox:1.28
ADD https://github.com/gohugoio/hugo/releases/download/v0.43/hugo_extended_0.43_Linux-64bit.tar.gz /hugo.tar.gz
RUN tar -zxvf hugo.tar.gz
RUN ["/hugo", "version"]
The resulting error is:
standard_init_linux.go:185: exec user process caused "no such file or directory"
Based on docker/labs#215 may this be caused by a problem during compilation of Hugo.
Please use https://discourse.gohugo.io/ for questions/troubleshooting. Also see Hugo Documentation.
Just to add some context: We're not staffed to troubleshoot in this repo. That's what the forum is for.
The extended version can be run in a docker container.
If you do
./bepdock.sh
CGO_ENABLED=1 go build -tags extended
./hugo -s docs
From this repo, that should be proof that it's possible. The Docker container I'm using for testing above is the same that is used for the release build.
This extended release is still young, and these issues will smooth themselves out with a little time, I hope ...
Hi,
I'm very sorry about following up on this on Github if this is really just a problem at my end.
To me it looks like your commands provided above never actually runs Hugo inside a Docker environment.
Could you please add this command to your list?
docker run --rm -it -v $(pwd)/hugo:/hugo busybox /hugo version
In my environment runs the standard edition just fine and the extended edition fails with the above command when using the official Hugo binaries for Linux.
If this happens to work just fine in your environment with a newly compiled version may the extended edition binary for Linux be corrupt.
Hi, sorry for jumping in.
IMHO the issue appears to be that Alpine (and other light-weight images like Busybox) do not include /lib64/ld-linux-x86-64.so.2, on which the “extended” Hugo 0.43 depends. Unfortunately most (if not all) pre-built Hugo images on Docker Hub (like jojomi/Hugo or klakegg/hugo) are based on Alpine and do not work currently.
The same extended 0.43 binary runs just fine in containers with larger base images, such as Debian or Ubuntu (I just made the switch to a Debian base image on a server I run and I can confirm that it works).
Shortest sequence of commands to demonstrate the issue on Alpine:
docker run -it --rm alpine:latest
wget https://github.com/gohugoio/hugo/releases/download/v0.43/hugo_extended_0.43_Linux-64bit.tar.gz
tar -xf hugo_extended_0.43_Linux-64bit.tar.gz
./hugo
/bin/sh: ./hugo: not found
The “not found” error (weirdly) indicates a missing dependency.
As I said: Use the forum.
I've updated klakegg/hugo to now provide images based upon Debian and Ubuntu for extended edition of Hugo. I hope this fixes my problems for now.
I'm unable to find information in the Hugo documentation regarding the extended edition, and the release note for 0.43 ("a single binary with native and fast implementations") does not provide information about the new extended edition having different requirements related to running environment than the standard edition.
on alpine adding the packages libc6-compat g++ will fix this.
FROM alpine:latest as hugo-base
ENV VERSION 0.55.2
RUN apk add --no-cache git openssl py-pygments libc6-compat g++ curl
RUN curl -L https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_extended_${VERSION}_Linux-64bit.tar.gz | tar -xz \
&& cp hugo /usr/bin/hugo \
&& apk del curl \
&& hugo version
But building sites will fail
Segmentation fault (core dumped)
Building sites … 2019/04/21 19:22:50 build_docs : exit code 139
You can workaround segmentation fault issue by applying muslstack on hugo extended executable and running it in alpine:edge image.
I've submitted a merge request for registry image updates in https://gitlab.com/pages/hugo. If you want to try it out, please use registry.gitlab.com/yaegashi/hugo/hugo_extended for now until it gets merged.
Most helpful comment
I've updated klakegg/hugo to now provide images based upon Debian and Ubuntu for extended edition of Hugo. I hope this fixes my problems for now.
I'm unable to find information in the Hugo documentation regarding the extended edition, and the release note for 0.43 ("a single binary with native and fast implementations") does not provide information about the new extended edition having different requirements related to running environment than the standard edition.