dockerdocker-registrydockerhub

Does one need one repository per docker image?


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?


Solution

  • 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.

    my-repository:my-first-image-latest
    my-repository:my-second-image-latest
    

    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.