快速設置docker國內加速鏡像

我們使用docker默認的鏡像服務器時,拉去鏡像經常會連接超時,因爲可以通過配置國內鏡像解決該問題。

方式一(推薦):傻瓜式命令爲curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s https://registry.docker-cn.com

重啓docker:service docker restart

方式二:手動配置

1、創建或修改 /etc/docker/daemon.json 文件:

vim /etc/docker/daemon.json

2、修改爲如下形式:

{
    "registry-mirrors": ["http://hub-mirror.c.163.com"]
}
systemctl restart docker.service

3、按EXC鍵後,:wq。保存。

4、然後重新啓動docker即可(linux命令:sudo systemctl restart docker)。

其中[xxx]括號裏面的則爲國內鏡像地址,有如下推薦,也可以去網上去查找其他的國內鏡像。

Docker中國區官方鏡像
https://registry.docker-cn.com

網易
http://hub-mirror.c.163.com

ustc 
https://docker.mirrors.ustc.edu.cn

中國科技大學
https://docker.mirrors.ustc.edu.cn

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章