使用docker默认镜像经常出现速度慢甚至中断等情况,如何处理呢?可以使用镜像。软件源和扩展源详细安装步骤请看。
国内常用安装源有中国科技大学、阿里云、docker-cn、dockercloud、网易和华为。
使用清华大学镜像逐步安装docker-ce安装操作过程如下
#清华大学CentOS 镜像帮助https://mirrors.tuna.tsinghua.edu.cn/help/centos/#清华大学epel 镜像帮助https://mirrors.tuna.tsinghua.edu.cn/help/epel/#安装依赖软件[root@promote ~]#yum install -y yum-utils device-mapper-persistent-data lvm2#配置加速镜像repo文件[root@promote ~]# yum-config-manager \> --add-repo \> https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo已加载插件:fastestmirroradding repo from: https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repograbbing file https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.reporepo saved to /etc/yum.repos.d/docker-ce.repo#清除yum缓存[root@promote ~]# yum clean all#重新创建yum缓存[root@promote ~]# yum makecache#安装docker-ce[root@promote ~]# yum install docker-ce docker-ce-cli containerd.io#[root@promote ~]# sudo systemctl daemon-reload[root@promote ~]# sudo systemctl restart docker
配置docker其他镜像源。(阿里云为例)
#本页面有阿里云centos 和epel 镜像 可以Ctrl+F5搜索点击help链接https://opsx.alibaba.com/mirror
阿里云配置账号命令如下:
#xxxxxxxx 是个人加速器地址sudo mkdir -p /etc/dockersudo tee /etc/docker/daemon.json <<-'EOF'{ "registry-mirrors": ["https://xxxxxxxx.mirror.aliyuncs.com"]}EOFsudo systemctl daemon-reloadsudo systemctl restart docker
本文推荐配置2个安装源,分别是中国科技大学和阿里云,其他四个根据个人需求先择配置。注意:阿里云、华为云和网易云需要登录账号获取个人加速地址。具体命令如下
#部分docker安装后未生成daemon.json,请执行以下命令[root@promote ~]# mkdir -p /etc/docker[root@promote ~]# touch /etc/docker/daemon.json #配置文件[root@promote ~]# vim /etc/docker/daemon.json#以下三种配置文件任选一个 #配置文件1 (中国科技大学)[root@promote ~]# cat /etc/docker/daemon.json { "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]}#配置文件2 (docker-cn){ "registry-mirrors": ["https://registry.docker-cn.com"]}#访问以下地址获取和安装脚本文件,适用于Linux、Mac和Windowshttps://www.daocloud.io/mirror
补充内容: