[Alpine Linux]glibcのインストール方法

LINEで送る
Pocket

[Docker][UNIX domain socket]Alpine Linuxで+Go+NginxをDockerfileで環境構築してみた!

昔こんなブログを書いたが、Alpine Linux 3.13系だとDockerfileは以下になる。

FROM alpine:3.13.5

# Setup UTC+9
RUN apk --update add tzdata && \
    cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime && \
    apk del tzdata && \
    rm -rf /var/cache/apk/*

# install packages
RUN apk update && \
    apk upgrade && \
    apk add --update --no-cache \
    autoconf \
    bash \ 
    libarchive-tools \
    mysql-client \
    vim \
    postgresql-client \
    supervisor 

# install glibc
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.33-r0/glibc-2.33-r0.apk
RUN apk add glibc-2.33-r0.apk
RUN rm /etc/apk/keys/sgerrand.rsa.pub glibc-2.33-r0.apk

# go 1.12.5 install,delete gz
RUN wget https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz --no-check-certificate -P /tmp
RUN tar -C /usr/local -xzf /tmp/go1.12.5.linux-amd64.tar.gz 
RUN rm /tmp/go1.12.5.linux-amd64.tar.gz

# settimg go path
ENV GOPATH /go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin

libc6-compat パッケージ入れると以下のようにエラーが出るのでメモ。

=> ERROR [ 6/16] RUN apk add glibc-2.33-r0.apk                                                                                                                                                                 0.5s
------
 > [ 6/16] RUN apk add glibc-2.33-r0.apk:
#9 0.434 (1/1) Installing glibc (2.33-r0)
#9 0.435 ERROR: glibc-2.33-r0: trying to overwrite lib64/ld-linux-x86-64.so.2 owned by libc6-compat-1.2.2-r0.
#9 0.495 1 error; 285 MiB in 97 packages

Was this helpful?

0 / 0

コメントを残す 0

Your email address will not be published. Required fields are marked *