> > In our project we'd chosen debian-slim images vs alpine few years ago due > to a number of reasons, if I recall arguments were like: > > 1. presence of libc >
There are reasons to choose other images over Alpine, but IMO avoiding musl libc is not one of them. In the case of x86_64 architecture, if you symlink ld-musl-x86_64.so.1 to ld-linux-x86-64.so.2, you can use musl libc in place of glibc, which is functional for most use cases. See this example Dockerfile to use a linux/arm64 Go release with an Alpine base image: FROM alpine:3.12 RUN ln -s lib lib64 && \ ln -s ld-musl-x86_64.so.1 lib/ld-linux-x86-64.so.2 RUN set -o pipefail && \ wget -O- https://golang.org/dl/go1.15.6.linux-amd64.tar.gz | \ tar xzC usr/local && \ rm -r usr/local/go/pkg/linux_amd64_race ENV PATH=${PATH}:/usr/local/go/bin \ GOPATH=/go Binaries built using this approach can run on other linux/amd64 platforms, even though CGO was not disabled. As a side note, the resultant image for the above Dockerfile is 369MB, whereas golang:alpine is only 299MB. The size difference is /usr/local/go/pkg/linux_amd64_race, which golang:alpine does not include (but golang:buster, for example, does). -Zach On Thu, Dec 17, 2020 at 5:44 AM Space A. <reexist...@gmail.com> wrote: > Hi Constantine, > > In our project we'd chosen debian-slim images vs alpine few years ago due > to a number of reasons, if I recall arguments were like: > > 1. presence of libc > 2. bugs and performance issues of alpine > 3. security issues of alpine > 4. debian is more suitable for testing with huge amount of tools available > out of the box, if needed > > > After all, talking about saving few tens of megs of hdd space per image > (it's the main reason for ppl selecting alpine) is ridiculous nowadays IMO. > > > > среда, 16 декабря 2020 г. в 20:10:49 UTC+3, Constantine Vassilev: > >> What about the size of images? For pure Golang project what are the >> advantages of glibc? >> >> For a project I have to present pro and cons before the team to decide. >> >> On Tuesday, December 15, 2020 at 6:03:29 PM UTC-8 amits...@gmail.com >> wrote: >> >>> >>> >>> On Wed, 16 Dec 2020, 12:38 pm Constantine Vassilev, <ths...@gmail.com> >>> wrote: >>> >>>> All examples in Google Cloud Run for building >>>> Golang Docker images are based on Debian. >>>> >>>> FROM golang:alpine AS builder >>>> ... >>>> FROM debian:buster-slim >>>> ... >>>> >>>> What are debian:buster-slim advantages vs alpine ones? >>>> >>> >>> Besides the size of the images, one key difference would be the >>> underlying C library - Debian would be glibc and Alpine would be libmusl >>> >>> So advantages would be if knowing that libc is available. >>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "golang-nuts" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to golang-nuts...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/golang-nuts/2433a1dd-c3ea-4c5c-9f6e-d1595cef99f9n%40googlegroups.com >>>> <https://groups.google.com/d/msgid/golang-nuts/2433a1dd-c3ea-4c5c-9f6e-d1595cef99f9n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/9f0bd697-286f-455a-afef-4a49e98fea80n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/9f0bd697-286f-455a-afef-4a49e98fea80n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAPp%3DCEwOKSatRaPcv8RdYTchFLKhe%2BA_z3O5geGtx-37CLbkOQ%40mail.gmail.com.