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

fastly-exporter-2.1.0-linux-amd64 doesn't work in alpine #22

Closed
ljagiello opened this issue Nov 16, 2018 · 4 comments · Fixed by #23
Closed

fastly-exporter-2.1.0-linux-amd64 doesn't work in alpine #22

ljagiello opened this issue Nov 16, 2018 · 4 comments · Fixed by #23

Comments

@ljagiello
Copy link
Contributor

ljagiello commented Nov 16, 2018

fastly-exporter-2.1.0-linux-amd64 doesn't work in alpine container.

fastly-exporter-2.0.0-linux-amd64:

➜  fastly-exporter cat Dockerfile-2.0.0
FROM alpine:3.8

RUN apk add --no-cache ca-certificates

RUN wget https://github.com/peterbourgon/fastly-exporter/releases/download/v2.0.0/fastly-exporter-2.0.0-linux-amd64 -O /fastly-exporter && chmod a+x fastly-exporter

ENTRYPOINT ["/fastly-exporter", "-endpoint", "http://0.0.0.0:8080/metrics"]
➜  fastly-exporter docker build --pull -t fastly-exporter-2.0.0 -f Dockerfile-2.0.0 .
[…]
➜  fastly-exporter docker run --rm fastly-exporter-2.0.0:latest
level=error err="-token is required"

fastly-exporter-2.1.0-linux-amd64:

➜  fastly-exporter cat Dockerfile-2.1.0
FROM alpine:3.8

RUN apk add --no-cache ca-certificates

RUN wget https://github.com/peterbourgon/fastly-exporter/releases/download/v2.1.0/fastly-exporter-2.1.0-linux-amd64 -O /fastly-exporter && chmod a+x fastly-exporter

ENTRYPOINT ["/fastly-exporter", "-endpoint", "http://0.0.0.0:8080/metrics"]
➜  fastly-exporter docker build --pull -t fastly-exporter-2.1.0 -f Dockerfile-2.1.0 .
[…]
➜  fastly-exporter docker run --rm fastly-exporter-2.1.0:latest
standard_init_linux.go:190: exec user process caused "no such file or directory"

It looks like 2.1.0 binary is not linked statically.

/ # ldd fastly-exporter-2.1.0-linux-amd64
	/lib64/ld-linux-x86-64.so.2 (0x7fa4e59f2000)
	libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7fa4e59f2000)
	libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fa4e59f2000)
/ # ldd fastly-exporter-2.0.0-linux-amd64
ldd: fastly-exporter-2.0.0-linux-amd64: Not a valid dynamic program
@mrnetops
Copy link
Contributor

mrnetops commented Nov 16, 2018

Huh. I used @peterbourgon s release.fish script for the binaries.

Looking closer, it doesn't look like the release.fish produced binaries are intended to be statically linked as there is not a reference to CGO_ENABLED=0 in the build command.

I would suggest not relying on the release binaries to be statically linked. @peterbourgon thoughts?

With regards to your Dockerfile construction, I would suggest using mrnetops/fastly-exporter from docker hub or the repository Dockerfile, which explicitly build a statically linked version for the container.

Otherwise, you are attempting to rely on release build side effects.

those images are also smaller as well ;)

docker images
REPOSITORY                  TAG                 IMAGE ID            CREATED             SIZE
ljagiello/fastly-exporter   latest              96839a74ade7        17 seconds ago      16MB
mrnetops/fastly-exporter    latest              41a65eb58cdf        2 hours ago         11.3MB
alpine                      3.8                 196d12cf6ab1        2 months ago        4.41MB

Please let me know if I'm missing a nuance of your usecase / docker build.

@ljagiello
Copy link
Contributor Author

Oh sure I can hack that around, it's just a different behavior between versions.

@ljagiello
Copy link
Contributor Author

PR: #23

@mrnetops
Copy link
Contributor

Release updated with new release.fish binaries.

I will however still suggest you not rely on wget of release binaries to do the right thing for your containers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants