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

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

拉取官方alpine

  1. docker pull alpine:latest

安装glibc

参考:https://github.com/sgerrand/alpine-pkg-glibc/

设置时区

  1. RUN echo -e “https://mirror.tuna.tsinghua.edu.cn/alpine/latest-stable/main\n\
  2. https://mirror.tuna.tsinghua.edu.cn/alpine/latest-stable/community” > /etc/apk/repositories
  3. # Install base packages
  4. RUN apk update && apk –no-cache add tzdata ca-certificates wget \
  5.     && cp -r -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

制作基础镜像

Dockerfile

  1. FROM alpine:latest
  2. RUN echo -e “https://mirror.tuna.tsinghua.edu.cn/alpine/latest-stable/main\n\
  3. https://mirror.tuna.tsinghua.edu.cn/alpine/latest-stable/community” > /etc/apk/repositories
  4. # Install base packages
  5. RUN apk update && apk –no-cache add tzdata ca-certificates wget \
  6.     && cp -r -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
  7. 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
  1. docker build -t hub.linuxeye.com/library/alpine:latest .   #生成镜像
  2. docker push hub.linuxeye.com/library/alpine:latest        #推送私有仓库

Fri Apr 13 17:36:32 CST 2018


【AD】炭云:768元/年/1GB内存/20GB SSD空间/2TB流量/500Mbps-1Gbps端口/独立IPv4/KVM/广州移动

【AD】美国洛杉矶CN2 VPS/香港CN2 VPS/日本CN2 VPS推荐,延迟低、稳定性高、免费备份_搬瓦工vps