现在使用 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
来源: https://www.cnblogs.com/woshimrf/p/docker-china-source.html