Docker加速器 DaoCloud
由于眾所周知的原因,從Docker Hub難以高效地下載鏡像。
除了使用VPN或代理之外,最為有效的方式就是使用Docker國內鏡像。
DaoCloud是首個提供國內免費Docker Hub鏡像的團體,可以使用DaoCloud團隊提供的Docker Hub Mirror服務。
Docker加速器簡介
Docker加速器是 DaoCloud 推出的 Docker Hub Mirror 服務的官方名稱。
Docker加速器提供Docker Registry(Docker Hub)在中國的鏡像代理服務,為中國用戶在國內服務器上緩存諸多鏡像。
當用戶的Docker設定了--registry-mirror參數后,用戶的Docker拉取鏡像時,首先去Docker加速器中查找鏡像,若命中則說明該鏡像已經在Docker加速器中緩存,用戶直接從Docker加速器中下載。
若沒有命中,則說該鏡像還沒有被緩存,那么Docker加速器首先會被驅使去Docker Hub中下載該鏡像,并進行緩存,最終讓用戶從Docker加速器中下載該鏡像。
Docker加速器使用說明
在DaoCloud注冊并登錄。
在登錄后的頁面(https://dashboard.daocloud.io/),點擊“產品->加速器”標簽,根據新彈出的頁面中“配置 Docker 加速器”信息,更改自己的 Docker 配置文件,然后重啟Docker,使之生效。
注意:此時,從“配置 Docker 加速器”信息中,我們其實已經得到一個免費的docker鏡像地址,類似于“http://abcd1234.m.daocloud.io”。
示例:配置及使用Docker加速器
這里以Linux系統為例。
Linux
curl -sSL?https://get.daocloud.io/daotools/set_mirror.sh?| sh -s?http://abcd1234.m.daocloud.io
該腳本可以將 --registry-mirror 加入到你的 Docker 配置文件 /etc/default/docker 中。適用于 Ubuntu14.04、Debian、CentOS6 、CentOS7、Fedora、Arch Linux、openSUSE Leap 42.1,其他版本可能有細微不同。更多詳情請訪問文檔。
配置Docker加速器
[root@CentOS-7 ~]# uname -aLinux CentOS-7 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux[root@CentOS-7 ~]#[root@CentOS-7 ~]# cat /etc/redhat-releaseCentOS Linux release 7.2.1511 (Core)[root@CentOS-7 ~]#[root@CentOS-7 ~]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://abcd1234.m.daocloud.ioSuccess.You need to restart docker to take effect: sudo systemctl restart docker[root@CentOS-7 ~]#[root@CentOS-7 ~]# systemctl restart docker[root@CentOS-7 ~]#如果重啟失敗就手動配置一下加速器在從啟,步驟:
使用Docker加速器拉取鏡像
[root@CentOS-7 ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE[root@CentOS-7 ~]#[root@CentOS-7 ~]# docker run ubuntuUnable to find image 'ubuntu:latest' locallyTrying to pull repository docker.io/library/ubuntu ...latest: Pulling from docker.io/library/ubuntub3e1c725a85f: Pull complete4daad8bdde31: Pull complete63fe8c0068a8: Pull complete4a70713c436f: Pull completebd842a2105a8: Pull completeDigest: sha256:dbe36a89ad8daf8bbd2a68f14eab18b969d3f125104da51df6337bbf08d1c8aeStatus: Downloaded newer image for docker.io/ubuntu:latest[root@CentOS-7 ~]#[root@CentOS-7 ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEdocker.io/ubuntu latest 104bec311bcd 8 days ago 128.9 MB[root@CentOS-7 ~]#?
總結
以上是生活随笔為你收集整理的Docker加速器 DaoCloud的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 科技暑期实习生面试记录
- 下一篇: Spring boot W