使用阿里云对docker拉取镜像加速

使用docker时,需要下载很多镜像,直接访问https://hub.docker.com/_/mysql?tab=tags外网下载又太慢。

阿里云可以加速下载:

 

1、注册登录阿里云,淘宝支付宝账号直接扫码登录:https://www.aliyun.com/

2、直接搜索:容器镜像服务(第一次需要开通)

3、复制加速地址(步骤3):

4、在/etc/docker目录下新建文件daemon.json将加速器地址写入:

[root@promote ~]# vim /etc/docker/daemon.json

5、写入你自己的加速地址:

{
  "registry-mirrors": ["https://******.mirror.aliyuncs.com"]
}

6、重启服务:

[root@promote ~]# systemctl daemon-reload
[root@promote ~]# systemctl restart docker

最后显示:

[root@promote ~]# docker info

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 1.13.1
Storage Driver: overlay2
 Backing Filesystem: xfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: journald
Cgroup Driver: systemd
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: docker-runc runc
Default Runtime: docker-runc
Init Binary: /usr/libexec/docker/docker-init-current
containerd version:  (expected: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1)
runc version: 66aedde759f33c190954815fb765eedc1d782dd9 (expected: 9df8b306d01f59d3a8029be411de015b7304dd8f)
init version: fec3683b971d9c3ef73f284f176672c44b448662 (expected: 949e6facb77383876aeff8a6944dde66b3089574)
Security Options:
 seccomp
  WARNING: You're not using the default seccomp profile
  Profile: /etc/docker/seccomp.json
 selinux
Kernel Version: 3.10.0-862.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
Number of Docker Hooks: 3
CPUs: 4
Total Memory: 974.6 MiB
Name: promote.cache-dns.local
ID: M4N7:EJTO:64PI:5SC3:BJYX:GAS4:UBE4:43IJ:ZVP4:RIQC:JHVQ:VWK3
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Registry Mirrors:
 https://******.mirror.aliyuncs.com
Live Restore Enabled: false
Registries: docker.io (secure)

7、最后搜索docker镜像,如果能搜到表示加速器搭建成功

docker search nginx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值