Docker国内镜像source

现在使用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

posted @ 2019-04-12 11:31  Ryan.Miao  阅读(10083)  评论(2编辑  收藏  举报