Tag (tag), push (push), Draw (pull) your own mirror

Source: Internet
Author: User
Tags docker hub docker run
CatalogueStart using Docker to install Docker understanding mirrors (Images) and containers (containers) on OS X to search & Run Whalesay image Build your own image create a Docker Hub Account & Library ( Repository) tag (tag), push (push), Draw (pull) your own mirror

In this section, you will mark and push your docker-whale image into the new hub library you just created. When you're done, you can pull your new image to test if your hub library is working. first step: Mark and push Image

If you don ' t already has a terminal open, open one now:

Open Launchpad and navigate to the Docker Quickstart terminal icon.

Click the Docker Quickstart Terminal icon to open a window.

Position the cursor to the Docker Quickstart terminal window

Enter the docker images command to view the current list of mirrors:

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

Locate the image ID of the Docker-whale image

In this example, the ID is 7d9495d03763

It is important to note that the Hub library shows the name of the library instead of the namespace. After the Docker hub has associated the Docker-whale image with the Docker hub account, you need to rename it to Your_dockerhub_username/docker-whale. Your account name displays the mirrored namespace in the Docker hub. You will do this in the next tag image.

Use the image ID and the Docker tag command to mark the Docker-whale image.

The command seems to look like this:

Of course your account name should be your own, so you need to use your account name and image ID in this command, then press ENTER.

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

Enter the docker images command again to view the current list of mirrors:

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

Use the docker login command to log in to the Docker Hub from the command line

The format of the login command is this:

Docker Login--username=yourhubusername--email=youremail@company.com

When the command returns a response Yes, enter your password and press ENTER, so, like this:

$ docker Login--username=maryatdocker--email=mary@docker.com
Password:
warning:login credentials saved in C : \users\sven\.docker\config.json
Login succeeded

Enter the Docker push command to push your image to the hub library

$ docker Push Maryatdocker/docker-whale The
push refers to a repository [Maryatdocker/docker-whale] (len:1)
7d94 95d03763:image already exists
C81071adeeb5:image successfully pushed
Eb06e47a01d2:image successfully pushed< C7/>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

Return to your Docker hub page to view your new image

Step Two: Pull the new image

In this last section, you'll pull the image you just pushed to the Docker hub. Before you do this, you need to remove the original image from the local computer. If you do not delete it, Docker will not pull the mirror from the hub-why not. Because two images are the same.

Position the cursor to the Docker Quickstart terminal window

Enter Docker images to list your current local mirrors

    $ 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

To test success, you need to remove whale and docker images from the local system. Delete Maryatdocker/docker-whale and Docker-whale. They force the next time Docker pull is used, Docker gets the mirror from the Hub library.

Use Docker RMI to remove Maryatdocker/docker-whale and docker-whale images.

You can use the image ID or name to delete

$ docker rmi-f 7d9495d03763
$ docker rmi-f Docker-whale

Use the Docker Run command to pull and load a new image from your hub library

Docker Run Yourusername/docker-whale

Because the mirror is no longer on the local system, Dokcer will download 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 e9e06 B06e14c:already exists A82efea989f9:already exists 37bea4ee0c81:already exists 07f8e8c5e660:already exists 676c4a1897e 6:already exists 5b74edbcaa5b:already exists 1722f41ddcb5:already exists 99da72cfe067:already exists 5D5BD9951E26:ALR Eady exists Fb434121fc77:already exists digest:sha256: ad89e88beb7dc73bf55d456e2c600e0a39dd6c9500d7cd8d1025626c4b985011 status:downloaded newer image for maryatdocker/ Docker-whale:latest ________________________________________/have 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, "The Man's best |   \ friend--and a great big dog, too! " 
                /
 ----------------------------------------
            \
             \
              \
                      ##        . ## ## ##       ==
             ## ## ## ##      ===
         /""""""""""""""""___/ ===
    ~~~ {~~ ~~~~ ~ ~ ~ ~ ~ ~ ~ ~/===-~ ~ ~ \______ o __/\ __/\____\______/

Where to go next

You've done a lot and you've done all of the following basic Docker tasks. Installing Docker running software image in a container find interesting mirrors in Docker hub run mirror on your own machine to modify the image, create a new image and run Create Docker hub account and library push your image to the Docker hub to share with others

But at this point, you're just in touch with all the basic things that Docker can do. Go to the next page for more information.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.