zoukankan      html  css  js  c++  java
  • 5、Tag, push, and pull your image

    In this section, you tag and push your docker-whale image to your newly created repository. When you are done, you test the repository by pulling your new image.

    Step 1: Tag and push the image

    1. Go back to your terminal.

    2. List the images you currently have:

      $ docker images
      REPOSITORY           TAG          IMAGE ID            CREATED             VIRTUAL SIZE
      docker-whale         latest       7d9495d03763        38 minutes ago      273.7 MB
      docker/whalesay      latest       fb434121fc77        4 hours ago         247 MB
      hello-world          latest       91c95931e552        5 weeks ago         910 B
      
    3. Find the IMAGE ID for your docker-whale image.

      In this example, the id is 7d9495d03763.

      You’ll notice that currently, the REPOSITORY shows the repository but not the namespace for docker-whale. You need to include the namespace for Docker Hub to associate it with your account. Thenamespace is the same as your account name.

    4. Use IMAGE ID and the docker tag command to tag your docker-whale image.

      The command you type looks like this:

      Of course, your account name will be your own. So, you type the command with your image’s ID and your account name and press RETURN.

      $ docker tag 7d9495d03763 maryatdocker/docker-whale:latest
      
    5. Type the docker images command again to see your newly tagged image.

      $ 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
      docker/whalesay             latest    fb434121fc77    5 hours ago      247 MB
      hello-world                 latest    91c95931e552    5 weeks ago      910 B
      
    6. Use the docker login command to log into the Docker Hub from the command line.

      The format for the login command is:

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

      When prompted, enter your password and press enter. So, for example:

      $ docker login --username=maryatdocker --email=mary@docker.com
      Password:
      WARNING: login credentials saved in C:Userssven.dockerconfig.json
      Login Succeeded
      
    7. Use the docker push command to push your image to your new repository.

      $ 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
      
    8. Return to your profile on Docker Hub to see your new image.

    Step 2: Pull your new image

    In this last section, you’ll pull the image you just pushed to hub. Before you do that though, you’ll need to remove the original image from your local machine. If you left the original image on your machine, Docker would not pull from the hub — why would it? The two images are identical.

    1. Place your cursor at the prompt in your terminal window.

    2. Type docker images to list the images you currently have on your local machine.

      $ 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
      docker/whalesay             latest    fb434121fc77    5 hours ago      247 MB
      hello-world                 latest    91c95931e552    5 weeks ago      910 B
      

      To make a good test, you need to remove the maryatdocker/docker-whale and docker-whaleimages from your local system. Removing them forces the next docker pull to get the image from your repository.

    3. Use the docker rmi to remove the maryatdocker/docker-whale and docker-whale images.

      You can use an ID or the name to remove an image.

      $ docker rmi -f 7d9495d03763
      $ docker rmi -f docker-whale
      
    4. Pull a new image from your repository using the docker pull command.

      The command you type should include your username from Docker Hub.

       docker pull yourusername/docker-whale
      

      Since the image is no longer available on your local system, Docker downloads it.

        $ 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          __/            
                                  __/             
                        \____\______/   
  • 相关阅读:
    winsock编程WSAAsyncSelect模型
    winsock编程select模型
    socket编程,简单多线程服务端测试程序
    模板singleton模式的C++实现
    windows socket函数详解
    ACE_Message_Block消息数据类
    ACE Socket Wrapper Facade
    ACE_Event_Handler:事件响应入口
    ACE_Time_Value
    华为ICDcomm接口js测试
  • 原文地址:https://www.cnblogs.com/devotion/p/5153887.html
Copyright © 2011-2022 走看看