土小帽 发表于 2023-11-3 21:46:57

alpine(Go环境)Docker基础镜像制作

拉取官方alpinedocker pull alpine:latest
安装glibc
参考:https://github.com/sgerrand/alpine-pkg-glibc/

设置时区RUN echo -e "https://mirror.tuna.tsinghua.edu.cn/alpine/latest-stable/main\n\
https://mirror.tuna.tsinghua.edu.cn/alpine/latest-stable/community" > /etc/apk/repositories
# Install base packages
RUN apk update && apk --no-cache add tzdata ca-certificates wget \
    && cp -r -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
制作基础镜像
DockerfileFROM alpine:latest
RUN echo -e "https://mirror.tuna.tsinghua.edu.cn/alpine/latest-stable/main\n\
https://mirror.tuna.tsinghua.edu.cn/alpine/latest-stable/community" > /etc/apk/repositories
# Install base packages
RUN apk update && apk --no-cache add tzdata ca-certificates wget \
    && cp -r -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.27-r0/glibc-2.27-r0.apk&& apk add glibc-2.27-r0.apk && rm -f glibc-2.27-r0.apk /etc/apk/keys/sgerrand.rsa.pub
docker build -t hub.linuxeye.com/library/alpine:latest .   #生成镜像
docker push hub.linuxeye.com/library/alpine:latest      #推送私有仓库
页: [1]
查看完整版本: alpine(Go环境)Docker基础镜像制作