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

Cannot build Docker image #2457

Closed
gouthamve opened this Issue Mar 1, 2017 · 7 comments

Comments

Projects
None yet
4 participants
@gouthamve
Copy link
Member

gouthamve commented Mar 1, 2017

What did you do?
make docker on master and then tried to run the image.

What did you expect to see?
Prometheus runs!

What did you see instead? Under which circumstances?
standard_init_linux.go:178: exec user process caused "no such file or directory"

Environment

  • System information:

Linux 4.9.8-1-ARCH x86_64

  • Prometheus version:
prometheus, version 1.5.2 (branch: gouthamve-1637, revision: 7e14533b32afb163209867c295918004e35f8eca)
  build user:       goutham@beast
  build date:       20170301-06:09:00
  go version:       go1.8

I think this is because of dynamic linking, but I would have expected make docker to run out of the box!

@sdurrheimer

This comment has been minimized.

Copy link
Member

sdurrheimer commented Mar 1, 2017

How did you build the prometheus binary ?

@gouthamve

This comment has been minimized.

Copy link
Member Author

gouthamve commented Mar 1, 2017

I did make. I also tried with:
go build -o prometheus github.com/prometheus/prometheus/cmd/prometheus

Both give the same issue :/

@gouthamve

This comment has been minimized.

Copy link
Member Author

gouthamve commented Mar 1, 2017

My hunch was right, when I compile it statically, it works!
I compiled it via

CGO_ENABLED=0 go build -a -o prometheus -installsuffix cgo github.com/prometheus/prometheus/cmd/prometheus

now prometheus starts up in docker!

@brancz

This comment has been minimized.

Copy link
Member

brancz commented Mar 1, 2017

Yes I've observed this as well, unfortunately the go compiler behaves differently when on OSX or linux. On OSX because there is no glibc to link to it compiles a binary that does not link to it, even when not explicitly disabling cgo. Then when you compile the same thing on linux there is a glibc available and so it links to it, and when you then put that binary in a container it doesn't work anymore.

@gouthamve

This comment has been minimized.

Copy link
Member Author

gouthamve commented Mar 1, 2017

Yes, I think we should be building static binaries only.

But I think this is an issue with promu or the config here. promu is building dynamic ones even after explicitly telling it not to.

@brancz

This comment has been minimized.

Copy link
Member

brancz commented Mar 1, 2017

Yes I agree, it's quite confusing as the binaries are actually built statically when releasing (using make crossbuild), so the released binaries are statically linked, but not the ones built with make build.

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 23, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 23, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.