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

  • A+
Categories:Linux

拉取官方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

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: