現在使用docker的鏡像大多基於幾種基本Linux系統。雖然我不需要在容器李安裝很多東西,但經常需要一些必要的工具,而基礎鏡像里並不包含,比如vim, ifconfig, curl等。考慮下載速度,最后修改鏡像的source為國內地址。現在收集一些docker的基礎鏡像中國鏡像源。
Github: https://github.com/Ryan-Miao/docker-china-source
docker hub國內鏡像
下載docker image也可以走國內鏡像。
/etc/docker/daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com", "http://hub-mirror.c.163.com","https://docker.mirrors.ustc.edu.cn"]
}
alpine
Alpine Linux is a security-oriented, lightweight Linux distribution based on musl libc and busybox.
特點是輕量,小,現在docker推薦的base鏡像系統,絕大多數公共docker鏡像都有alpine版本。
新建repositories
https://mirrors.aliyun.com/alpine/v3.6/main/
https://mirrors.aliyun.com/alpine/v3.6/community/
現在制作一個lua解析容器:
Dockerfile
FROM alpine
COPY repositories /etc/apk/repositories
RUN apk update && apk add vim curl net-tools lua
centos6
有時候還是想繼續用centos6.
wget http://mirrors.aliyun.com/repo/Centos-6.repo
Dockerfile
FROM centos:6
MAINTAINER Ryan Miao
WORKDIR /tmp
COPY Centos-6.repo /etc/yum.repos.d/CentOS-Base.repo
RUN yum clean all && yum makecache
RUN yum install -y vim git net-tools curl wget
debian
Debian是社區類Linux的典范,是迄今為止最遵循GNU規范的Linux系統, 包括Debian和Ubuntu等.
很多鏡像選擇debian作為基礎鏡像,比如nginx
新建sources.list
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb http://mirrors.163.com/debian/ stretch main non-free contrib
deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
Dockerfile
FROM nginx:1.15.10
MAINTAINER Ryan Miao <ryan.miao@nf-3.com>
COPY sources.list /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y net-tools procps curl wget vim telnet cron
