利用阿里云快速安装最新版docker和加速docker pull
Docker在国内安装和Docker pull都很慢,马云爸爸给广大的docker爱好者提供了便利:不仅可以在各个linux操作系统快速安装最新版的Docker,还免费提供了一个docker加速器,让大家免于Q的阻碍。
接下来,我来说下Ubuntu16.04如何接受马云爸爸的优惠:
一.替换为阿里云源:
先在终端输入以下命令:
<span class="hljs-built_in">sudo</span> vi /etc/apt/sources.list
- 1
然后删除sources.list里面的全部内容,替换为以下内容:
deb http://mirrors<span class="hljs-preprocessor">.aliyun</span><span class="hljs-preprocessor">.com</span>/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors<span class="hljs-preprocessor">.aliyun</span><span class="hljs-preprocessor">.com</span>/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors<span class="hljs-preprocessor">.aliyun</span><span class="hljs-preprocessor">.com</span>/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors<span class="hljs-preprocessor">.aliyun</span><span class="hljs-preprocessor">.com</span>/ubuntu/ xenial-backports main restricted universe multiverse
<span class="hljs-preprocessor">##测试版源</span>
deb http://mirrors<span class="hljs-preprocessor">.aliyun</span><span class="hljs-preprocessor">.com</span>/ubuntu/ xenial-proposed main restricted universe multiverse
<span class="hljs-preprocessor"># 源码</span>
deb-src http://mirrors<span class="hljs-preprocessor">.aliyun</span><span class="hljs-preprocessor">.com</span>/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors<span class="hljs-preprocessor">.aliyun</span><span class="hljs-preprocessor">.com</span>/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors<span class="hljs-preprocessor">.aliyun</span><span class="hljs-preprocessor">.com</span>/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors<span class="hljs-preprocessor">.aliyun</span><span class="hljs-preprocessor">.com</span>/ubuntu/ xenial-backports main restricted universe multiverse
<span class="hljs-preprocessor">##测试版源</span>
deb-src http://mirrors<span class="hljs-preprocessor">.aliyun</span><span class="hljs-preprocessor">.com</span>/ubuntu/ xenial-proposed main restricted universe multiverse
<span class="hljs-preprocessor"># Canonical 合作伙伴和附加</span>
deb http://archive<span class="hljs-preprocessor">.canonical</span><span class="hljs-preprocessor">.com</span>/ubuntu/ xenial partner
deb http://extras<span class="hljs-preprocessor">.ubuntu</span><span class="hljs-preprocessor">.com</span>/ubuntu/ xenial main
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
二.更新源和软件
<span class="hljs-built_in">sudo</span> apt-get update 更新源
<span class="hljs-built_in">sudo</span> apt-get upgrade 更新软件
- 1
- 2
三.安装curl
apt-<span class="hljs-keyword">get</span> install curl
- 1
注意:如果这里提示包冲突:
下列软件包有未满足的依赖关系:
curl : 依赖: libcurl3 (= <span class="hljs-number">7.35</span><span class="hljs-number">.0</span>-<span class="hljs-number">1u</span>buntu2<span class="hljs-number">.10</span>) 但是 <span class="hljs-number">7.47</span><span class="hljs-number">.0</span>-<span class="hljs-number">1u</span>buntu2<span class="hljs-number">.2</span> 正要被安装
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。
- 1
- 2
- 3
先执行:
apt-<span class="hljs-keyword">get</span> remove libcurl3
- 1
然后执行:
apt-<span class="hljs-keyword">get</span> install curl
- 1
即可!
四.安装Docker
执行命令:
curl -sSL http://acs-public-mirror<span class="hljs-preprocessor">.oss</span>-cn-hangzhou<span class="hljs-preprocessor">.aliyuncs</span><span class="hljs-preprocessor">.com</span>/docker-engine/internet | sh -
- 1
即可安装最新版的Docker!
当然,如果你用了阿里云主机,直接在内网执行下面这个脚本即可:
curl -sSL http://acs-public-mirror<span class="hljs-preprocessor">.oss</span>-cn-hangzhou<span class="hljs-preprocessor">.aliyuncs</span><span class="hljs-preprocessor">.com</span>/docker-engine/intranet | sh -
- 1
安装完后会在结束时打印如下内容:
Client:
Version: <span class="hljs-number">17.04</span><span class="hljs-number">.0</span>-ce
API <span class="hljs-built_in">version</span>: <span class="hljs-number">1.28</span>
Go <span class="hljs-built_in">version</span>: go1<span class="hljs-number">.7</span><span class="hljs-number">.5</span>
Git commit: <span class="hljs-number">4845</span>c56
Built: Mon Apr <span class="hljs-number">3</span> <span class="hljs-number">18</span>:<span class="hljs-number">07</span>:<span class="hljs-number">42</span> <span class="hljs-number">2017</span>
OS/Arch: linux/amd64
Server:
Version: <span class="hljs-number">17.04</span><span class="hljs-number">.0</span>-ce
API <span class="hljs-built_in">version</span>: <span class="hljs-number">1.28</span> (minimum <span class="hljs-built_in">version</span> <span class="hljs-number">1.12</span>)
Go <span class="hljs-built_in">version</span>: go1<span class="hljs-number">.7</span><span class="hljs-number">.5</span>
Git commit: <span class="hljs-number">4845</span>c56
Built: Mon Apr <span class="hljs-number">3</span> <span class="hljs-number">18</span>:<span class="hljs-number">07</span>:<span class="hljs-number">42</span> <span class="hljs-number">2017</span>
OS/Arch: linux/amd64
Experimental: <span class="hljs-constant">false</span>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
五.开启加速
打开阿里云docker镜像仓库,然后用自己的阿里账号登录,找到“加速器”,会有给自己的专属加速器。再用页面的提示开启加速即可!地址教程:https://cr.console.aliyun.com/#/accelerator,具体如下:
针对Docker客户端版本大于1.10的用户
您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器:
<span class="hljs-built_in">sudo</span> mkdir -p /etc/docker
<span class="hljs-built_in">sudo</span> tee /etc/docker/daemon.json <<-<span class="hljs-string">'EOF'</span>
{
<span class="hljs-string">"registry-mirrors"</span>: [<span class="hljs-string">"你的专属加速地址"</span>]
}
EOF
<span class="hljs-built_in">sudo</span> systemctl daemon-reload
<span class="hljs-built_in">sudo</span> systemctl restart docker
============ 欢迎各位老板打赏~ ===========
与本文相关的文章
- · Amazon Linux 2023 安装Docker和Docker Compose
- · 修改Docker的默认网段
- · docker定时任务Mysql脚本
- · 解决Linux实例磁盘空间满问题
- · failed to fetch metadata: fork/exec /home/appuser/.docker/cli-plugins/docker-buildx: exec format error
- · Docker登录login报错Error saving credentials
- · docker安装mysql8注意事项
- · 黑群晖docker无法pull镜像,x509错误解决方法
- · k3s+kuboard快速搭建K8s生产环境集群
- · 解决es报错:blocked by: [FORBIDDEN/12/index read-only / allow delete (api) ]
- · filebeat按docker容器名创建不同的索引
- · traefik负载均衡/滚动升级