Hello,
I’ve the usecase the place I need to precombile a go binary and use it as a microservice in a docker community.
I construct with this:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go construct -ldflags="-w -s" -o kardis
and my Dockerfile is that this:
FROM ubuntu:noble
WORKDIR /app
COPY kardis .
EXPOSE 6380
ENTRYPOINT ["/app/kardis"]
This works, but when I need to construct from scratch I get this error message
/lib/x86_64-linux-gnu/libc.so.6: model `GLIBC_2.34' not discovered (required by /app/kardis)
I perceive that there’s stuff wanted for my binary. However now the query: How can I discover the minimal wanted Docker picture start line? Any recommendation?
It is a kernel drawback of the working system, you’ll be able to improve the kernel of the ubuntu picture, or downgrade the golang model (you must verify the logs for which kernels golang model helps).
However often, golang releases are ok for the present mainstream kernel variations, and you might must downgrade golang releases if in case you have particular wants.
Thanks for the extra detailed clarification. However possibly I used to be not clear sufficient:
I need to select the smallest (or finest) working starter picture doable.
I believe utilizing ubuntu:newest is sufficient to get quite a bit finished, and it’s a sensible choice to compile internally in case you can (and take away golang stuff after you compile).
Compiling internally reduces lots of compatibility points.