-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
update glibc #1342
Comments
Also occuring to us. Following this topic. |
The
If you want to use go |
If you're stuck here, the image at cgr.dev/chainguard/glibc-dynamic works. I just tested with this go file and dockerfile: main.go: package main
import (
"fmt"
"os/user"
)
func main() {
u, _ := user.Current()
fmt.Println("USER: ", u.Username)
} Dockerfile: FROM golang
COPY main.go .
RUN CGO_ENABLED=1 go build -o /main main.go
FROM cgr.dev/chainguard/glibc-dynamic
COPY --from=0 main /main
CMD ["/main"] It works:
With this image: FROM golang
COPY main.go .
RUN CGO_ENABLED=1 go build -o /main main.go
FROM gcr.io/distroless/base
COPY --from=0 main /main
CMD ["/main"] dlorenc@MacBook-Pro-5 gotest % docker build . -t gcr
[+] Building 0.3s (11/11) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 220B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for gcr.io/distroless/base:latest 0.2s
=> [internal] load metadata for docker.io/library/golang:latest 0.0s
=> [stage-0 1/3] FROM docker.io/library/golang 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 65B 0.0s
=> CACHED [stage-1 1/2] FROM gcr.io/distroless/base@sha256:73deaaf6a207c1a33850257ba74e0f196bc418636cada9943a03d7abea980d6d 0.0s
=> CACHED [stage-0 2/3] COPY main.go . 0.0s
=> CACHED [stage-0 3/3] RUN CGO_ENABLED=1 go build -o /main main.go 0.0s
=> [stage-1 2/2] COPY --from=0 main /main 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:8948bb219ef0beb9669c764dc3e808ae04c6e34ee6b575ae2d8fb3c1891b86ac 0.0s
=> => naming to docker.io/library/gcr 0.0s
dlorenc@MacBook-Pro-5 gotest % docker run gcr
/main: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /main)
/main: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /main) If you're curious, the chainguard images are built using glibc 2.37: https://github.com/wolfi-dev/os/blob/main/glibc.yaml |
Thanks! Yeah, for now we're just holding golang version back to 1.20.4 ... but I'll try the bookworm thing in the coming days |
This is due to the changeover of the |
Using
|
SolutionAfter the above, build image on I guess that BTW, the above running env is in |
Use golang: bullseye as build time and base-debian11 as runtime could solve this issue example yaml: FROM golang:1.20.6-bullseye as builder
WORKDIR /go/src/
# For docker buildx multi-platform building
ARG TARGETARCH
# Build path send from build-arg
ARG SOURCE
ARG PKGPATH
# General git information
ARG SERVICENAME
ARG GITTAG
ARG GITBRANCH
ARG GITCOMMIT
# Copy source codes and build
COPY . .
RUN export BUILDDATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") && \
CGO_ENABLED=1 \
GOOS=linux \
GOARCH=${TARGETARCH} \
go install -mod=vendor \
-ldflags="-w -s \
-X $PKGPATH.serviceName=$SERVICENAME \
-X $PKGPATH.gitTag=$GITTAG \
-X $PKGPATH.gitCommit=$GITCOMMIT \
-X $PKGPATH.gitBranch=$GITBRANCH \
-X $PKGPATH.buildDate=$BUILDDATE \
" -v ${SOURCE}
# For minimal image
FROM gcr.io/distroless/base-debian11
COPY --from=builder --chown=65532:65532 /go/bin/cmd /opt/
COPY configs/* /opt/
ENTRYPOINT ["/opt/cmd"]
CMD ["--config", "default.json"]
|
debian12 images are available for base, base-nossl and static. I believe this should now be working. |
@loosebazooka I am using the latest distroless/cc, it's still using distroless/base is not working for us as well as it does not have |
are you using distroless/cc-debian12 ? |
Using distroless base-debian12 (instead of debian11) fixed this for me |
Golang 1.20.5 uses glibc 2.32, while gcr.io/distroless/base-debian11:latest has 2.31
As a result it leads to the error
The text was updated successfully, but these errors were encountered: