Created
June 24, 2019 20:35
-
-
Save larzza/0f070a1b61c1d6a699653c9a792294be to your computer and use it in GitHub Desktop.
Install glibc in Alpine docker image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RUN apk --no-cache add \ | |
wget \ | |
ca-certificates \ | |
libstdc++ | |
# Get and install glibc for alpine | |
ARG APK_GLIBC_VERSION=2.29-r0 | |
ARG APK_GLIBC_FILE="glibc-${APK_GLIBC_VERSION}.apk" | |
ARG APK_GLIBC_BIN_FILE="glibc-bin-${APK_GLIBC_VERSION}.apk" | |
ARG APK_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${APK_GLIBC_VERSION}" | |
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \ | |
&& wget "${APK_GLIBC_BASE_URL}/${APK_GLIBC_FILE}" \ | |
&& apk --no-cache add "${APK_GLIBC_FILE}" \ | |
&& wget "${APK_GLIBC_BASE_URL}/${APK_GLIBC_BIN_FILE}" \ | |
&& apk --no-cache add "${APK_GLIBC_BIN_FILE}" \ | |
&& rm glibc-* |
i am getting this:
[+] Building 3.3s (7/8)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 37B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/alpine:latest 1.7s
=> ERROR FROM docker.io/library/build:latest 1.4s
=> => resolve docker.io/library/build:latest 1.4s
=> CACHED [stage-1 1/4] FROM docker.io/library/alpine:latest@sha256:82d1e9d7ed48a7523bdebc18cf6290bdb97b82302a8a9c27d4fe88594 0.0s
=> [stage-1 2/4] RUN apk --no-cache add wget ca-certificates libstdc++ 1.1s
=> CANCELED [stage-1 3/4] RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub 0.4s
------
> FROM docker.io/library/build:latest:
------
failed to load cache key: pull access denied, repository does not exist or may require authorization: server message: insufficient_sc
ope: authorization failed
this is the relevant section from the dockerfile -
...
FROM alpine:latest
RUN apk --no-cache add \
wget \
ca-certificates \
libstdc++
# Get and install glibc for alpine
ARG APK_GLIBC_VERSION=2.37
ARG APK_GLIBC_FILE="glibc-${APK_GLIBC_VERSION}.apk"
ARG APK_GLIBC_BIN_FILE="glibc-bin-${APK_GLIBC_VERSION}.apk"
ARG APK_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${APK_GLIBC_VERSION}"
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
&& wget "${APK_GLIBC_BASE_URL}/${APK_GLIBC_FILE}" \
&& apk --no-cache add "${APK_GLIBC_FILE}" \
&& wget "${APK_GLIBC_BASE_URL}/${APK_GLIBC_BIN_FILE}" \
&& apk --no-cache add "${APK_GLIBC_BIN_FILE}" \
&& rm glibc-*
...
gcompat
should provide glibc on Alpine
apk update && apk add --no-cache gcompat libstdc++
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is four years old, so not shocking it doesn't work, but to anyone finding this in 2023, you'll likely get this:
The final run block just needs to be updated to:
(note the addition of
--force-overwrite
)