使用docker默认镜像常常出现速度慢甚至中断等状况,如何处理呢?能够使用镜像。软件源和扩展源详细安装步骤请看教程。html
国内经常使用安装源有中国科技大学、阿里云、docker-cn、dockercloud、网易和华为。linux
使用清华大学镜像逐步安装docker-ce安装操做过程以下docker
#清华大学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 已加载插件:fastestmirror adding repo from: https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo grabbing file https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo repo 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其余镜像源。(阿里云为例)json
#本页面有阿里云centos 和epel 镜像 能够Ctrl+F5搜索点击help连接 https://opsx.alibaba.com/mirror
阿里云配置帐号命令以下:vim
#xxxxxxxx 是我的加速器地址 sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://xxxxxxxx.mirror.aliyuncs.com"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker
本文推荐配置2个安装源,分别是中国科技大学和阿里云,其余四个根据我的需求先择配置。注意:阿里云、华为云和网易云须要登陆帐号获取我的加速地址。具体命令以下centos
#部分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和Windows https://www.daocloud.io/mirror
Docker中国镜像加速app