Lab 5.1 - Two questions regarding the code, tag and private repository name
Hello,
I have a couple of questions regarding this lab.
1 - When the local respository is created, why there is no name specified for the local registry?
Command below simply runs the image "registry". $ docker run -d -p 5000:5000 --restart=always --name registry registry:2
2 - When we push the image to the repository, how do we know it will be pushed to the local repository we have just created? What happens if we have more than 1 private repository?
Command below simply tells to push the tagged image, but it does not mention where.
$ docker image push localhost:5000/myalps
However, the outcome of this commands, tells us that the image has been pushed to
Using default tag: latest
The push refers to repository [localhost:5000/myalps]
bc276c40b172: Pushed
Does it mean that the name of the respository is the same as the name of the image tag? What happens if we want to send more than 1 image to the same repository?
Thanks in advance.
Sincerely,
Josep Maria
Best Answers
-
Hi @josepmaria,
The
--nameflag is used to assign the nameregistryto the container running the imageregistry:v2. In the same command, theregistryrepository becomes available only on port5000of the container host, because it was mapped as such in the command.One can deploy multiple isolated private registries on the same host (such as
registry-v2,registry-development), but each registry will have to be mapped to a different port number on the host - since port5000of the host is already mapped to the registry namedregistry.When the image is tagged the registry address and the desired application name are assigned to the image. If desired, the registry's address can be aliased.
Regards,
-Chris1 -
Does it mean that the name of the repository is the same as the name of the image tag?
Yes the name of the repository is the same as the name of the "image" - so the name of your repository from the example you gave would be myalps (the tag is automatically set to the latest since you didn't explicitly upload a 'tagged' image)
What happens if we want to send more than 1 image to the same repository?
If you upload another version of your image "after" tagging it with a new name... for example:
- docker tag -t myalps myalps:v1
- docker image push localhost:5000/myalps:v1
Then the new version will live in the /myalps repo. If you want to see the versioned/tagged images in the repo you can run this curl command:
Basic command:
curl -X GET http://localhost:5000/v2/myalps/tags/list
Or you can pipe it through the jq command to see a prettier output
curl -sX GET http://localhost:5000/v2/myalps/tags/list | jq
Or to see a Catalog of all your uploaded repositories
curl -X GET http://localhost:5000/v2/_catalog
Or you can install skopeo to inspect an image on a remote registry, including your private registry
sudo dnf install -y skopeo
skopeo inspect --tls-verify=false docker://localhost:5000/myalps | jq .RepoTags
As a side note, when using podman instead of docker you can run the following:
podman search --tls-verify=false localhost:5000/
For some reason docker search will not show you the contents of a private yesterday. Googling, I think it has something to do with the search command being only compatible with v1 docker API as far as searching private registries goes.
1 -
Hi @josepmaria,
When we push the image to the repository, how do we know it will be pushed to the local repository we have just created? What happens if we have more than 1 private repository?
As @chrispokorni stated, the different private registries are essentially differentiated by the port number. So you will have a different port number for each registry. Since localhost normally points back to your host system the different registries would be like:
localhost:5000
localhost:6000
localhost:7000And so on...
Each image needs to have that registry name as part of the images name, so the following would all go to different registries:
docker image push localhost:5000/myalps
docker image push localhost:6000/myalps
docker image push localhost:7000/myalpsAnd they would all have the tag of "latest" unless you already have the image tagged otherwise and specify the tag in the push.
docker image push localhost:5000/myalps:v1
1
Answers
-
Hello @elliotmywebguy ,
Thank you very much for your time and detailed answers, I appreciate it.
Sincerely,
Josep Maria
0 -
Hey @josepmaria no problem at all. Any time.
E.
1
Categories
- All Categories
- 177 LFX Mentorship
- 177 LFX Mentorship: Linux Kernel
- 755 Linux Foundation IT Professional Programs
- 375 Cloud Engineer IT Professional Program
- 170 Advanced Cloud Engineer IT Professional Program
- 74 DevOps IT Professional Program - Discontinued
- 5 DevOps & GitOps IT Professional Program
- 100 Cloud Native Developer IT Professional Program
- 7.6K Training Courses & Learning Paths
- 2 AI & ML Training
- 1 Blockchain & Decentralized Identity Training
- 5 Cloud & Containers Training
- 1 Cybersecurity Training
- 2 DevOps & Site-Reliability Training
- 1 Linux Kernel Development Training
- 1 Networking Training
- 2 Open Source Best Practice Training
- 2 System Administration Training
- 1 System Engineering Training
- 1 Web & Application Development Training
- 794 Hardware
- 202 Drivers
- 68 I/O Devices
- 37 Monitors
- 95 Multimedia
- 173 Networking
- 91 Printers & Scanners
- 89 Storage
- 769 Linux Distributions
- 81 Debian
- 68 Fedora
- 22 Linux Mint
- 13 Mageia
- 24 openSUSE
- 150 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 356 Ubuntu
- 465 Linux System Administration
- 31 Cloud Computing
- 73 Command Line/Scripting
- Github systems admin projects
- 98 Linux Security
- 78 Network Management
- 101 System Management
- 46 Web Management
- 112 Mobile Computing
- 20 Android
- 77 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 393 Off Topic
- 121 Introductions
- 182 Small Talk
- 29 Study Material
- 980 Programming and Development
- 310 Kernel Development
- 652 Software Development
- 993 Software
- 385 Applications
- 182 Command Line
- 5 Compiling/Installing
- 68 Games
- 317 Installation
- Archived
- 2 LFD140 Class Forum
- 1.4K LFS258 Class Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)