When pushing to Docker Hub, the format of the tag is <username>/<repository>:<tag>
.
To my knowledge, repository
can be understood as the image name (e.g. my application name) and tag
as the version
So, if I want to push two different images (not just different versions, but different applications) does that in turn mean that I would need two repositories? So the Docker Hub free plan with only one free private registry would only be sufficient for one docker application image?
2
Answers
One does not need a separate repository per docker image.
You can hack your way around the limitation—which you have correctly identified—by using the same repository name, but a different tag name, for each image.
Simply embed the image name and the version name into the tag.
You will lose some of the functionality provided by Docker Hub. (This is also true if you’re using the AWS Docker registry). Whether it’s worth it to spend N times the money to get those features back is up to you.
A tag is just a string to the registry (with limits on characters and length). Each tag is effectively a symbolic link to an image, you can have multiple images in a repository, and a registry may have lots of repositories. To the registry, it doesn’t know that two different tags are pointing to two different versions of the same application, or two completely different applications packaged in images.
From an organizational view, you typically separate repositories by application since tools often treat the tag as a version, and because access restrictions are controlled at the repository level, not per tag.