Docker build tag repository name

后端 未结 1 749
长情又很酷
长情又很酷 2021-02-13 18:31

One can easily build docker images through docker build command.

What I\'m wondering is the t flag that you can give when building the image. For example:



        
相关标签:
1条回答
  • 2021-02-13 19:19

    I believe the confusion here is the word "repository." In Docker, a repository is any group of builds of an image with the same name, and potentially multiple tags. A "registry" server, like hub.docker.com or your own private registry, holds multiple repositories, e.g. the redis repository on the public registry. That one repository has multiple tags for different versions of the build.

    So with that background, to answer your questions:

    1. ouruser/sinatra is located on your local Docker host until you do a docker push
    2. No, the repository and the tag is the name of the image.
    3. While local on your system, you can use this image locally. Once you push it up to a registry, you can then pull it down to any other Docker host that has access to that registry. And if you do a docker save you can save that image for a docker load on another host.
    4. I'm sure there is documentation covering this somewhere on docs.docker.com, but I learned from a class.
    5. The username/imagebase format came about to support pushing to your own namespace in hub.docker.com. Without that, whoever makes the first "Redis" image calls it "redis" while the next person makes their own repository called "redis-improved", and we quickly get into a jumble of confusing names where it's not clear who made what and what is a reputable image. That naming isn't required for images you make locally, but is still encouraged since images you pull from hub.docker.com may lack a username if they are maintained by Docker themselves. Without your username, you won't know which images you pulled down and which you built yourself.
    0 讨论(0)
提交回复
热议问题