小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

標(biāo)記(Tag),推送(Push),拉取(Pull)你自己的鏡像

 關(guān)平藏書 2019-01-22

目錄

在這一部分, 你會標(biāo)記, 推送你的docker-whale鏡像到你剛才新建好的Hub庫中. 當(dāng)你做好只好, 你可以拉去你的新鏡像來測試你的Hub庫是否正常.

第一步: 標(biāo)記和推送鏡像

If you don’t already have a terminal open, open one now:

  1. 打開Launchpad并定位到Docker Quickstart Terminal圖標(biāo).

    這里寫圖片描述

  2. 點擊Docker Quickstart Terminal圖標(biāo), 打開一個窗口.

  3. 將光標(biāo)定位到Docker Quickstart Terminal窗口

  4. 輸入docker images命令來查看當(dāng)前的鏡像列表:

    $ docker images
    REPOSITORY           TAG          IMAGE ID            CREATED             VIRTUAL SIZE
    docker-whale         latest       7d9495d03763        38 minutes ago      273.7 MB
    <none>               <none>       5dac217f722c        45 minutes ago      273.7 MB
    docker/whalesay      latest       fb434121fc77        4 hours ago         247 MB
    hello-world          latest       91c95931e552        5 weeks ago         910 B
  5. 找到docker-whale鏡像的image id

    在這個例子中, id是7d9495d03763

    值得注意的是, Hub庫顯示的是庫的名稱而不是命名空間. 對于Docker Hub將docker-whale鏡像與Docker Hub帳戶相關(guān)聯(lián)后, 你需要為它重命名為YOUR_DOCKERHUB_USERNAME/docker-whale. 您的帳戶名稱會在Docker Hub中顯示鏡像的命名空間. 你會在下一步標(biāo)記鏡像中做到這一點.

  6. 使用IMAGE IDdocker tag命令來標(biāo)記docker-whale鏡像.

    命令看來起來像這樣子:

    這里寫圖片描述

    當(dāng)然你的賬戶名稱應(yīng)該是你自己的, 所以, 你要在這個命令中使用自己的賬戶名稱和鏡像ID, 然后按回車.

    $ docker tag 7d9495d03763 maryatdocker/docker-whale:latest

  7. 再次輸入docker images命令來查看當(dāng)前的鏡像列表:

    $ docker images
    REPOSITORY           TAG          IMAGE ID            CREATED             VIRTUAL SIZE
    docker-whale         latest       7d9495d03763        38 minutes ago      273.7 MB
    <none>               <none>       5dac217f722c        45 minutes ago      273.7 MB
    docker/whalesay      latest       fb434121fc77        4 hours ago         247 MB
    hello-world          latest       91c95931e552        5 weeks ago         910 B
  8. 使用docker login命令從命令行登陸Docker Hub

    登陸命令的格式是這樣的:

    docker login --username=yourhubusername --email=youremail@company.com

    當(dāng)命令返回響應(yīng)是, 輸入你的密碼并按回車, 所以, 像這樣:

    $ docker login --username=maryatdocker --email=mary@docker.com
    Password:
    WARNING: login credentials saved in C:\Users\sven\.docker\config.json
    Login Succeeded
  9. 輸入docker push命令來推送你的鏡像到Hub庫

    $ docker push maryatdocker/docker-whale
    The push refers to a repository [maryatdocker/docker-whale] (len: 1)
    7d9495d03763: Image already exists
    c81071adeeb5: Image successfully pushed
    eb06e47a01d2: Image successfully pushed
    fb434121fc77: Image successfully pushed
    5d5bd9951e26: Image successfully pushed
    99da72cfe067: Image successfully pushed
    1722f41ddcb5: Image successfully pushed
    5b74edbcaa5b: Image successfully pushed
    676c4a1897e6: Image successfully pushed
    07f8e8c5e660: Image successfully pushed
    37bea4ee0c81: Image successfully pushed
    a82efea989f9: Image successfully pushed
    e9e06b06e14c: Image successfully pushed
    Digest: sha256:ad89e88beb7dc73bf55d456e2c600e0a39dd6c9500d7cd8d1025626c4b985011
  10. 返回你在Docker Hub的頁面查看你的新鏡像

    這里寫圖片描述

第二步: 拉取新鏡像

在這最后一節(jié),你會拉取你剛剛推送到Docker Hub上的鏡像。在此之前, 你需要從本地計算機中刪除原始鏡像. 如果你沒有刪除, Docker不會從Hub上拉取鏡像 - 為什么這樣呢?因為兩個圖像是相同的.

  1. 將光標(biāo)定位到Docker Quickstart Terminal窗口

  2. 輸入docker images來列出你當(dāng)前在本地的鏡像列表

        $ docker images
    REPOSITORY                  TAG       IMAGE ID        CREATED          VIRTUAL SIZE
    maryatdocker/docker-whale   latest    7d9495d03763    5 minutes ago    273.7 MB
    docker-whale                latest    7d9495d03763    2 hours ago      273.7 MB
    <none>                      <none>    5dac217f722c    5 hours ago      273.7 MB
    docker/whalesay             latest    fb434121fc77    5 hours ago      247 MB
    hello-world                 latest    91c95931e552    5 weeks ago      910 B

    為了測試成功,你需要從本地系統(tǒng)中刪除了鯨和泊塢窗鯨圖像。刪除maryatdocker/docker-whaledocker-whale. 它們迫使下次使用docker pull時, Docker從Hub庫中獲取鏡像.

  3. 使用docker rmi刪除maryatdocker/docker-whaledocker-whale鏡像.

    你可以使用鏡像ID或者名稱刪除

    $ docker rmi -f 7d9495d03763
    $ docker rmi -f docker-whale
  4. 使用docker run命令從你的Hub庫中拉取并加載新的鏡像

    docker run yourusername/docker-whale

    由于鏡像不再在本地系統(tǒng)上,Dokcer要下載它。

        $ docker run maryatdocker/docker-whale
    Unable to find image 'maryatdocker/docker-whale:latest' locally
    latest: Pulling from maryatdocker/docker-whale
    eb06e47a01d2: Pull complete
    c81071adeeb5: Pull complete
    7d9495d03763: Already exists
    e9e06b06e14c: Already exists
    a82efea989f9: Already exists
    37bea4ee0c81: Already exists
    07f8e8c5e660: Already exists
    676c4a1897e6: Already exists
    5b74edbcaa5b: Already exists
    1722f41ddcb5: Already exists
    99da72cfe067: Already exists
    5d5bd9951e26: Already exists
    fb434121fc77: Already exists
    Digest: sha256:ad89e88beb7dc73bf55d456e2c600e0a39dd6c9500d7cd8d1025626c4b985011
    Status: Downloaded newer image for maryatdocker/docker-whale:latest
     ________________________________________
    / Having wandered helplessly into a      | blinding snowstorm Sam was greatly     |
    | relieved to see a sturdy Saint Bernard |
    | dog bounding toward him with the       |
    | traditional keg of brandy strapped to  |
    | his collar.                            |
    |                                        |
    | "At last," cried Sam, "man's best      |
    \ friend -- and a great big dog, too!"   /
     ----------------------------------------
                                                                 ##        .
                    ## ## ##       ==
                 ## ## ## ##      ===
             /""""""""""""""""___/ ===
        ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
             \______ o          __/
              \    \        __/
                \____\______/

下一步去哪里

你已經(jīng)做了很多,你已經(jīng)做了所有的以下基本Docker任務(wù)。

  • 安裝Docker
  • 在容器中運行的軟件鏡像
  • 在Docker Hub中查找有趣的鏡像
  • 你自己的機器上運行鏡像
  • 修改鏡像, 創(chuàng)建新的鏡像并運行
  • 創(chuàng)建Docker Hub帳戶和庫
  • 推送你的鏡像到Docker Hub與他人分享

不過至此, 你只是接觸了Docker所有能做的基本內(nèi)容. 轉(zhuǎn)到下一個頁面, 了解更多信息.

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多