centos下搭建docker私人倉庫

來源:互聯網
上載者:User

標籤:虛擬化 docker

      目前Docker Registry已經升級到了v2,最新版的Docker已不再支援v1。Registry v2使用Go語言編寫,在效能和安全性上做了很多最佳化,重新設計了鏡像的儲存格式。此文檔是在v1的基礎上寫的,如果需要安裝registry v2,只需下載registry:2.2即可,或者可以下載後面的安裝指令碼運行安裝。


一、下載registry鏡像

docker pull registry


二、啟動私人倉庫容器,預設情況下,會將倉庫存放於容器內的/tmp/registry目錄下,這樣如果容器被刪除,則存放於容器中的鏡像也會丟失,所以我們一般情況下會指定本地一個目錄掛載到容器內的/tmp/registry下

docker run -d -p 5000:5000 -v /data/docker/registry:/tmp/registry registry


三、查看啟動進程

docker ps -a


CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                    NAMES

9dc25301d44f        registry            "docker-registry"   20 seconds ago      Up 18 seconds       0.0.0.0:5000->5000/tcp   reverent_ptolemy


四、建立鏡像連結或為基礎鏡像打個標籤

docker tag docker.io/centos6.7-base 10.44.86.222:5000/centos6.7-base


五、提交鏡像到本地私人倉庫中

docker push 10.44.86.222:5000/centos6.7-base


六、如果報以下錯誤,需要修改/etc/sysconfig/docker檔案

Error response from daemon: invalid registry endpoint https://10.44.86.222:5000/v0/: unable to ping registry endpoint https://10.44.86.222:5000/v0/

v2 ping attempt failed with error: Get https://10.44.86.222:5000/v2/: EOF

 v1 ping attempt failed with error: Get https://10.44.86.222:5000/v1/_ping: EOF. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry 10.44.86.222:5000` to the daemon‘s arguments. In the case of HTTPS, if you have access to the registry‘s CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/10.44.86.222:5000/ca.crt


在/etc/sysconfig/docker檔案添加以下選項:

other_args=‘--insecure-registry 10.44.86.222:5000‘

OPTIONS=‘--selinux-enabled --insecure-registry 10.44.86.222:5000‘


因為從docker1.3.2版本開始預設docker registry使用的是https


七、查看私人倉庫是否存在對應的鏡像


curl 10.44.86.222:5000/v1/search


{"num_results": 1, "query": "", "results": [{"description": "", "name": "library/centos6.7-base"}]}



本文出自 “我的營運時光” 部落格,請務必保留此出處http://aaronsa.blog.51cto.com/5157083/1740747

centos下搭建docker私人倉庫

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.