Sometimes Docker Hub really is just the quickest and easiest way to share an image from one place to another, particularly when the place I’m trying to share to is expecting to just do a docker pull
. It’s not always the case that I want to share those images with the rest of the world though. Docker Hub’s answer to this is the private repository but, on a free plan, you only get one private repository. What you have to remember though is that a repository can contain multiple images: they all share the same name but each has a different tag.
So, a while back I created a repository in my personal namespace called private and made it private using the button on the settings page:
When I then want to push an image up I use the local name as the tag. For example:
1 2 |
docker tag secretimage dcurrie/private:secretimage docker push dcurrie/private:secretimage |
Simple as that. There are obviously limitations here in that I lose the ability to have multiple versions of my image with different tags but so far, for my limited use cases, I’ve been able to live with that. In fairness to Docker Inc, I should say that have multiple private repositories is not the only reason to pay for an account on Docker Hub. You also get the ability to run parallel builds on.