-python
一、基於前面docker的部署,容器一多很是不便於管理,因而急需一個本身的docker私有庫; 二、而目前市面上大多數的私有庫基本上都是後臺服務加前臺ui構成,因而選來選去,最後選擇了portainer管理界面; 三、之因此選擇portainer這款管理界面,我就簡述闡述一下,基於如下幾點綜合考慮而爲之: 3.1 DockerUI 無登陸驗證,沒法權限分配,不支持多主機; 3.2 Shipyard 支持集羣,支持權限分配,啓動容器較多,佔用每一個節點的一部分資源; 3.3 Portainer 輕量級著稱,消耗資源少,雖然功能沒有Shipyard強大,但麻雀雖小五臟俱全,知足基本需求; 3.4 Daocloud 功能強大,部分高級功能收費,安裝稍微難度大點,土豪公司無外乎都會選擇此項; 四、注意:下面的 my_host_ip 字符串,請你們換成大家本身的宿主機ip地址便可;
// 利用docker搜索命令,看看能搜索包含registry字段的東西,能出來個啥東西 [root@svr01 ~]# docker search registry INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED docker.io docker.io/registry The Docker Registry 2.0 implementation for... 1847 [OK] docker.io docker.io/konradkleine/docker-registry-frontend Browse and modify your Docker registry in ... 177 [OK] docker.io docker.io/hyper/docker-registry-web Web UI, authentication service and event r... 123 [OK] 。。。。。。 docker.io docker.io/convox/registry 0 docker.io docker.io/kontena/registry Kontena Registry 0 docker.io docker.io/lorieri/registry-ceph Ceph Rados Gateway (and any other S3 compa... 0 docker.io docker.io/mattford63/registry The officail docker-registry with python-m... 0
// 隨便拉取了一個指定版本,也能夠拉取下來 [root@svr01 ~]# docker pull docker.io/registry:2.3.1 Trying to pull repository docker.io/library/registry ... 2.3.1: Pulling from docker.io/library/registry fdd5d7827f33: Pull complete a3ed95caeb02: Pull complete a79b4a92697e: Pull complete 6cbb75c7cc30: Pull complete 4831699594bc: Pull complete Digest: sha256:9bd58f43fdf3c378ee7f19ec6e355a5ecbfad8eab82c77079b974b5a78b59e4d [root@svr01 ~]# [root@svr01 ~]# [root@svr01 ~]# [root@svr01 ~]# [root@svr01 ~]# // 獲取一個最新的版本,只要網絡暢通,基本上都能獲取下來 [root@svr01 ~]# docker pull docker.io/registry Using default tag: latest Trying to pull repository docker.io/library/registry ... latest: Pulling from docker.io/library/registry 81033e7c1d6a: Pull complete b235084c2315: Pull complete c692f3a6894b: Pull complete ba2177f3a70e: Pull complete a8d793620947: Pull complete Digest: sha256:672d519d7fd7bbc7a448d17956ebeefe225d5eb27509d8dc5ce67ecb4a0bce54 [root@svr01 ~]# [root@svr01 ~]# [root@svr01 ~]# [root@svr01 ~]# [root@svr01 ~]# // 查看咱們拉取的鏡像是否都已經存在本地了 [root@svr01 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/registry latest d1fd7d86a825 3 weeks ago 33.26 MB springms/gateway-zuul latest f3825f14878c 6 weeks ago 248.5 MB springms/provider-user latest 5f8a95ffddae 6 weeks ago 270.6 MB springms/discovery-eureka latest 825e3f54be46 6 weeks ago 252.5 MB springms-simple-provider-user latest 7ccdcdd5270f 6 weeks ago 235.6 MB springms-user latest 4799ed153086 6 weeks ago 235.6 MB docker.io/centos v2 11efb35f320c 6 weeks ago 307.5 MB docker.io/frolvlad/alpine-oraclejdk8 latest 4f03dc990224 8 weeks ago 170.1 MB frolvlad/alpine-oraclejdk8 slim 4f03dc990224 8 weeks ago 170.1 MB docker.io/centos latest 3fa822599e10 8 weeks ago 203.5 MB docker.io/hello-world latest f2a91732366c 10 weeks ago 1.848 kB docker.io/registry 2.3.1 83139345d017 23 months ago 165.8 MB
[root@svr01 ~]# docker run -d -p 5000:5000 --restart=always -v /tmp/docker-var/:/var/lib/registry registry:2.3.1
// 經過 curl 命令測試, 正常狀況能打印些東西出來 [root@svr01 ~]# curl http://my_host_ip:5000/v2 <a href="/v2/">Moved Permanently</a>. // 經過瀏覽器輸入 http://my_host_ip:5000/v2 地址試試,正常狀況下回輸出{}一個空的大括號內容。
// 打一個tag文件 [root@svr01 ~]# docker tag busybox my_host_ip:5000/busybox [root@svr01 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE my_host_ip:5000/busybox latest 5b0d59026729 7 days ago 1.146 MB docker.io/busybox latest 5b0d59026729 7 days ago 1.146 MB docker.io/registry latest d1fd7d86a825 3 weeks ago 33.26 MB springms/gateway-zuul latest f3825f14878c 6 weeks ago 248.5 MB springms/provider-user latest 5f8a95ffddae 6 weeks ago 270.6 MB springms/discovery-eureka latest 825e3f54be46 6 weeks ago 252.5 MB springms-simple-provider-user latest 7ccdcdd5270f 6 weeks ago 235.6 MB springms-user latest 4799ed153086 6 weeks ago 235.6 MB docker.io/centos v2 11efb35f320c 6 weeks ago 307.5 MB docker.io/frolvlad/alpine-oraclejdk8 latest 4f03dc990224 8 weeks ago 170.1 MB frolvlad/alpine-oraclejdk8 slim 4f03dc990224 8 weeks ago 170.1 MB docker.io/centos latest 3fa822599e10 8 weeks ago 203.5 MB docker.io/hello-world latest f2a91732366c 10 weeks ago 1.848 kB docker.io/registry 2.3.1 83139345d017 23 months ago 165.8 MB docker.io/konradkleine/docker-registry-frontend latest 7621ed3504d4 23 months ago 234.9 MB // push文件到倉庫 [root@svr01 ~]# docker push ip:5000/busybox The push refers to a repository [my_host_ip:5000/busybox] Get https://my_host_ip:5000/v1/_ping: http: server gave HTTP response to HTTPS client [root@svr01 ~]# docker push my_host_ip:5000/busybox The push refers to a repository [my_host_ip:5000/busybox] Get https://my_host_ip:5000/v1/_ping: http: server gave HTTP response to HTTPS client // 結果發現出錯了, 修改 /etc/docker/daemon.json 文件,支持文件推送 文件內容爲:{"insecure-registries":["my_host_ip:5000"]} // 重啓docker [root@svr01 ~]# service docker restart Redirecting to /bin/systemctl restart docker.service [root@svr01 ~]# // 推送文件 [root@svr01 ~]# docker push my_host_ip:5000/busybox The push refers to a repository [my_host_ip:5000/busybox] 4febd3792a1f: Pushed latest: digest: sha256:4cee1979ba0bf7db9fc5d28fb7b798ca69ae95a47c5fecf46327720df4ff352d size: 527 [root@svr01 ~]#
[root@svr01 ~]# curl http://my_host_ip:5000/v2/_catalog {"repositories":["busybox"]} [root@svr01 ~]#
// 刪除已經存在的鏡像 [root@svr01 ~]# docker rmi my_host_ip:5000/busybox:latest Untagged: my_host_ip:5000/busybox:latest Untagged: my_host_ip:5000/busybox@sha256:4cee1979ba0bf7db9fc5d28fb7b798ca69ae95a47c5fecf46327720df4ff352d [root@svr01 ~]# // 下載鏡像 [root@svr01 ~]# docker pull my_host_ip:5000/busybox Using default tag: latest Trying to pull repository my_host_ip:5000/busybox ... latest: Pulling from my_host_ip:5000/busybox Digest: sha256:4cee1979ba0bf7db9fc5d28fb7b798ca69ae95a47c5fecf46327720df4ff352d // 查看一下,my_host_ip:5000/busybox 鏡像已經下載下來了 [root@svr01 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/busybox latest 5b0d59026729 7 days ago 1.146 MB my_host_ip:5000/busybox latest 5b0d59026729 7 days ago 1.146 MB docker.io/registry latest d1fd7d86a825 3 weeks ago 33.26 MB springms/gateway-zuul latest f3825f14878c 6 weeks ago 248.5 MB springms/provider-user latest 5f8a95ffddae 6 weeks ago 270.6 MB springms/discovery-eureka latest 825e3f54be46 6 weeks ago 252.5 MB springms-simple-provider-user latest 7ccdcdd5270f 6 weeks ago 235.6 MB springms-user latest 4799ed153086 6 weeks ago 235.6 MB docker.io/centos v2 11efb35f320c 6 weeks ago 307.5 MB frolvlad/alpine-oraclejdk8 slim 4f03dc990224 8 weeks ago 170.1 MB docker.io/frolvlad/alpine-oraclejdk8 latest 4f03dc990224 8 weeks ago 170.1 MB docker.io/centos latest 3fa822599e10 8 weeks ago 203.5 MB docker.io/hello-world latest f2a91732366c 10 weeks ago 1.848 kB docker.io/registry 2.3.1 83139345d017 23 months ago 165.8 MB docker.io/konradkleine/docker-registry-frontend latest 7621ed3504d4 23 months ago 234.9 MB [root@svr01 ~]#
[root@svr01 ~]# docker pull docker.io/portainer/portainer Using default tag: latest Trying to pull repository docker.io/portainer/portainer ... latest: Pulling from docker.io/portainer/portainer d1e017099d17: Pull complete d63e75e16ec8: Pull complete Digest: sha256:232742dcb04faeb109f1086241f290cb89ad4c0576e75197e902ca6e3bf3a9fc [root@svr01 ~]#
[root@svr01 ~]# docker run -d -p 9000:9000 --restart=always -v /var/run/docker.sock:/var/run/docker.sock --name parainer-test docker.io/portainer/portainer
瀏覽器輸入 http://my_host_ip:9000/ 而後便可看到UI管理界面;
https://gitee.com/ylimhhmily/SpringCloudTutorial.gitgit
SpringCloudTutorial交流QQ羣: 235322432web
SpringCloudTutorial交流微信羣: 微信溝通羣二維碼圖片連接spring
歡迎關注,您的確定是對我最大的支持!!!docker