日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

容器学习 之 本地镜像与共有镜像(十)

發布時間:2024/2/28 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 容器学习 之 本地镜像与共有镜像(十) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

共有鏡像docker hub

  • 首先得在 Docker Hub 上注冊一個賬號。
  • 在 Docker Host 上登錄。
  • root@ubuntu:/home/yj# docker login Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. Username: laster0xox0 Password: Login Succeeded
  • 修改鏡像的 repository 使之與 Docker Hub 賬號匹配。
    Docker Hub 為了區分不同用戶的同名鏡像,鏡像的 registry 中要包含用戶名,完整格式為:[username]/image:tag
  • root@ubuntu:/home/yj# docker tag httpd laster0xox0/httpd:v1 root@ubuntu:/home/yj# docker images laster0xox0/httpd REPOSITORY TAG IMAGE ID CREATED SIZE laster0xox0/httpd v1 0240c8f5816c 10 days ago 132MB
  • 通過 docker push 將鏡像上傳到 Docker Hub。 Docker 會上傳鏡像的每一層。
  • root@ubuntu:/home/yj# docker push laster0xox0/httpd:v1 The push refers to repository [docker.io/laster0xox0/httpd] 7857c7afb135: Mounted from library/httpd 0ace1cc25781: Mounted from library/httpd 355bd981febe: Mounted from library/httpd 504b6a6a6fd2: Mounted from library/httpd 237472299760: Mounted from library/httpd v1: digest: sha256:a1ae45c9153b02ccf2d790882a7aa833fcef8cc1fa5fd3cc3990c2e41fb47c6c size: 1367
  • 登錄 https://hub.docker.com,在Public Repository 中就可以看到上傳的鏡像。如果要刪除上傳的鏡像,只能在 Docker Hub 界面上操作。

  • 這個鏡像可被其他 Docker host 下載使用了。

  • root@ubuntu:/home/yj# docker pull laster0xox0/httpd:v1 v1: Pulling from laster0xox0/httpd Digest: sha256:a1ae45c9153b02ccf2d790882a7aa833fcef8cc1fa5fd3cc3990c2e41fb47c6c Status: Image is up to date for laster0xox0/httpd:v1

    本地倉庫Registry

  • 啟動 registry 容器。
  • root@ubuntu:/home/yj# docker run -d -p 5000:5000 -v /myregistry:/var/lib/registry registry:2 Unable to find image 'registry:2' locally 2: Pulling from library/registry d6a5679aa3cf: Pull complete ad0eac849f8f: Pull complete 2261ba058a15: Pull complete f296fda86f10: Pull complete bcd4a541795b: Pull complete Digest: sha256:5a156ff125e5a12ac7fdec2b90b7e2ae5120fa249cf62248337b6d04abc574c8 Status: Downloaded newer image for registry:2 0e9835e9c0cebbe31aeabc076c1df8a24a7fa2435266882da5db6ac440d27899
  • 通過 docker tag 重命名鏡像,使之與 registry 匹配。
  • root@ubuntu:/home/yj# docker tag laster0xox0/httpd:v1 127.0.0.1:5000/laster0xox0/httpd:v1

    repository 的完整格式為:[registry-host]:[port]/[username]/xxx

  • 通過 docker push 上傳鏡像。
  • root@ubuntu:/home/yj# docker push 127.0.0.1:5000/laster0xox0/httpd:v1 The push refers to repository [127.0.0.1:5000/laster0xox0/httpd] 7857c7afb135: Pushed 0ace1cc25781: Pushed 355bd981febe: Pushed 504b6a6a6fd2: Pushed 237472299760: Pushed
  • 查看本地鏡像
  • root@ubuntu:/myregistry/docker/registry/v2/repositories# docker search 127.0.0.1:5000/laster0xox0 Error response from daemon: Unexpected status code 404 root@ubuntu:/myregistry/docker/registry/v2/repositories# curl http://127.0.0.1:5000/v2/_catalog {"repositories":["laster0xox0/httpd"]}
  • 現在已經可通過 docker pull 從本地 registry 下載鏡像了。
  • 超強干貨來襲 云風專訪:近40年碼齡,通宵達旦的技術人生

    總結

    以上是生活随笔為你收集整理的容器学习 之 本地镜像与共有镜像(十)的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。