本文小編為大家詳細(xì)介紹“docker如何創(chuàng)建私有鏡像registry”,內(nèi)容詳細(xì),步驟清晰,細(xì)節(jié)處理妥當(dāng),希望這篇“docker如何創(chuàng)建私有鏡像registry”文章能幫助大家解決疑惑,下面跟著小編的思路慢慢深入,一起來(lái)學(xué)習(xí)新知識(shí)吧。
網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、微信平臺(tái)小程序開發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了漯河免費(fèi)建站歡迎大家使用!
一、下載 registry 鏡像
[root@localhost ~]# docker pull registry Using default tag: latest latest: Pulling from library/registry c87736221ed0: Pull complete 1cc8e0bb44df: Pull complete 54d33bcb37f5: Pull complete e8afc091c171: Pull complete b4541f6d3db6: Pull complete Digest: sha256:f87f2b82b4873e0651f928dcde9556008314543bd863b3f7e5e8d03b04e117f7 Status: Downloaded newer image for
二、創(chuàng)建鏡像存儲(chǔ)目錄
[root@localhost ~]# mkdir
三、創(chuàng)建鏡像容器
[root@localhost ~]# docker run -itd -v /data/registry:/var/lib/registry -p 80:5000name registry registry e630985b09af4dedcf81a8dcb80202e591fefefc0a86e8328be70ce0643ab399
#檢查容器是否創(chuàng)建成功 [root@localhost ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e630985b09af registry "/entrypoint.sh /etc…" 23 seconds ago Up 22 seconds 0.0.0.0:80->5000/tcp registry
#檢查容器運(yùn)行是否正常,如下顯示說(shuō)明運(yùn)行正常 [root@localhost ~]# curl http://127.0.0.1/v2/_catalog {"repositories":[]}
四、修改daemon.json文件,修改為如下內(nèi)容
[root@localhost ~]# vim /etc/docker/daemon.json { "registry-mirrors": ["https://wixr8yss.mirror.aliyuncs.com"], "insecure-registries":["10.10.0.110:80"], "bip":"172.31.0.1/16" }
五、重啟docker
[root@localhost ~]# systemctl restart docker
六、測(cè)試
#從官方pull busybox 鏡像 [root@localhost ~]# docker pull busybox Using default tag: latest latest: Pulling from library/busybox 53071b97a884: Pull complete Digest: sha256:4b6ad3a68d34da29bf7c8ccb5d355ba8b4babcad1f99798204e7abb43e54ee3d Status: Downloaded newer image for
#查看當(dāng)前鏡像 [root@localhost ~]# docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE busybox latest 64f5d945efcc 5 days ago 1.2MB registry latest f32a97de94e1 2 months ago 25.8MB
#為鏡像打tag [root@localhost ~]# docker tag busybox:latest 10.10.0.110:80/busybox:v1
#查看tag 是否標(biāo)記成功 [root@localhost ~]# docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE 10.10.0.110/busybox v1 64f5d945efcc 5 days ago 1.2MB busybox latest 64f5d945efcc 5 days ago 1.2MB registry latest f32a97de94e1 2 months ago 25.8MB
#將鏡像推送到私有鏡像倉(cāng)庫(kù)中 [root@localhost ~]# docker push 10.10.0.110:80/busybox:v1 The push refers to repository [10.10.0.110:80/busybox] d1156b98822d: Pushed v1: digest: sha256:4fe8827f51a5e11bb83afa8227cbccb402df840d32c6b633b7ad079bc8144100 size: 527
#測(cè)試?yán)$R像 [root@localhost repositories]# docker pull 10.10.0.110:80/busybox:v1 v1: Pulling from busybox 53071b97a884: Pull complete Digest: sha256:4fe8827f51a5e11bb83afa8227cbccb402df840d32c6b633b7ad079bc8144100 Status: Downloaded newer image for 10.10.0.110:80/busybox:v1
七、查看當(dāng)前私有倉(cāng)庫(kù)中有哪些鏡像以及鏡像的tag
[root@localhost repositories]#//10.10.0.110:80/v2/_catalog {"repositories":["busybox"]} [root@localhost repositories]# curl http://10.10.0.110:80/v2/busybox/tags/list {"name":"busybox","tags":["v1"]}
讀到這里,這篇“docker如何創(chuàng)建私有鏡像registry”文章已經(jīng)介紹完畢,想要掌握這篇文章的知識(shí)點(diǎn)還需要大家自己動(dòng)手實(shí)踐使用過(guò)才能領(lǐng)會(huì),如果想了解更多相關(guān)內(nèi)容的文章,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。