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

Missing gcc which is needed to make .test binaries. #153

Closed
timothysc opened this issue Mar 17, 2017 · 6 comments · Fixed by docker-library/docs#1749
Closed

Missing gcc which is needed to make .test binaries. #153

timothysc opened this issue Mar 17, 2017 · 6 comments · Fixed by docker-library/docs#1749
Labels
Request Request for image modification or feature

Comments

@timothysc
Copy link

So gcc is needed to make test binaries, and I see in your Dockerfile that you delete it from a builddep dir.

Use case:
go test -i -c -o battery.test github.com/yaddayadda/pkg/battery

The standard golang container works ok, b/c the tooling is installed, but ideally I'd like to use the trim'd alpine containers.

@yosifkit
Copy link
Member

Basically a duplicate of #119; specifically #119 (comment):

For many/most users, it isn't necessary, and it cannot be removed after the fact, so we intentionally try to keep the Alpine image as slim as possible.

See also https://github.com/docker-library/docs/blob/7a1edc542ec7d17626ec5cee87e87ed99da71afb/golang/README.md#golangalpine, specifically:

To minimize image size, it's uncommon for additional related tools (such as git or bash) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the alpine image description for examples of how to install packages if you are unfamiliar). base, add the things you need in your own Dockerfile (see the alpine image description for examples of how to install packages if you are unfamiliar).

@timothysc
Copy link
Author

I disagree with the size vs. usefulness constraint on language/build containers. For runtime containers that makes perfect sense, but this is a language/tooling container. Also, there is not parity in tools needed across the different golang containers.

@wglambert wglambert added the Request Request for image modification or feature label Apr 25, 2018
@khezen
Copy link

khezen commented Aug 28, 2018

For many/most users, it isn't necessary, and it cannot be removed after the fact, so we intentionally try to keep the Alpine image as slim as possible.

I disagree with this statement. I believe many/most people would have a multi stage dockerfile in which they would build their binaries using golang:x.x.x-alpinex.x and run the built binary on a slim alpine:x.x. It feels to me that removing the tooling defeats the purpose here.

@tianon
Copy link
Member

tianon commented Jan 22, 2019

See also #250 (comment), especially:

I think our image description should probably link directly to golang/go#19938 -- to summarize that thread's current state, Alpine is not actually an officially supported target for the maintainers of Go (it's non-trivial enough to get the test suite passing on Alpine that we're coming up on two years since it was first attempted in earnest).

The reason this is relevant here is that ... I'm afraid it will lend more to the appearance of Alpine being something not only supported, but potentially even recommended by the Go team, which is definitely not accurate (and if we had a clean way to de-emphasize our current Alpine variants until that issue is resolved and upstream officially supports it, I would definitely be considering it).

@goku321
Copy link

goku321 commented Jan 6, 2020

I am using golang:alpine as my docker image(go version 1.13.5) and there's no gcc. I had to install it manually.

@Freyert
Copy link

Freyert commented Jun 23, 2020

Doing a RUN apk add build-base adds about 207 MB to alpine so you're not really that much better off using it.

It makes more sense to build using a more well supported distro and just copying into the slim version of that distro. Debian's slim distro is typically around 27MB which is less than the golang version because believe it or not golang is a pretty big install.

Not sure you can really get below 150MB for an image that compiles golang binaries. Alpine linux provides sort of a "false" benefit. If you're going for small you might as well use a scratch container and run just your binary.

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

Successfully merging a pull request may close this issue.

7 participants