Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run Hugo extended in Docker #4939

Closed
klakegg opened this issue Jul 12, 2018 · 10 comments

Comments

@klakegg
Copy link
Contributor

@klakegg klakegg commented Jul 12, 2018

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.

@bep

This comment has been minimized.

Copy link
Member

@bep bep commented Jul 12, 2018

Please use https://discourse.gohugo.io/ for questions/troubleshooting. Also see Hugo Documentation.

@bep bep closed this Jul 12, 2018
@bep

This comment has been minimized.

Copy link
Member

@bep bep commented Jul 12, 2018

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 ...

@klakegg

This comment has been minimized.

Copy link
Contributor Author

@klakegg klakegg commented Jul 12, 2018

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.

@LorenzCK

This comment has been minimized.

Copy link
Contributor

@LorenzCK LorenzCK commented Jul 12, 2018

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).

@LorenzCK

This comment has been minimized.

Copy link
Contributor

@LorenzCK LorenzCK commented Jul 12, 2018

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.

@bep

This comment has been minimized.

Copy link
Member

@bep bep commented Jul 12, 2018

As I said: Use the forum.

@klakegg

This comment has been minimized.

Copy link
Contributor Author

@klakegg klakegg commented Jul 12, 2018

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.

@ryandanthony

This comment has been minimized.

Copy link

@ryandanthony ryandanthony commented Apr 19, 2019

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
	
@PatWie

This comment has been minimized.

Copy link

@PatWie PatWie commented Apr 21, 2019

But building sites will fail

Segmentation fault (core dumped)
Building sites … 2019/04/21 19:22:50 build_docs : exit code 139
@yaegashi

This comment has been minimized.

Copy link

@yaegashi yaegashi commented Jun 20, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.