<p>I'm working on a personal project in order to finally learn Kubernetes. After much struggle I managed to get the basic <code>nginx</code> Docker image (from Docker Hub) running on a pod and exposed as a NodePort service. Now I'm interested in swapping out the <code>nginx</code> Docker image for my own application.</p>
<p>The majority of tutorials online say &quot;push your image to Docker Hub&quot; at this point, then you tell Kubernetes to load your image from Docker Hub. However whenever possible I prefer to avoid any dependency on third-party services (what if in 5 years Docker Hub goes down and I have a company whose entire infrastructure is dependent on it? An unlikely scenario, but just an example of why I prefer to keep things self-contained, isolated, and independent)</p>
<p>I did some reading and found that in order to load a custom docker image <em><strong>without</strong></em> Docker Hub you have to build the image &quot;on the Kubernetes node&quot;. But what if I have a cluster consisting of 2 or more nodes? Does the image need to be build on <em><strong>each</strong></em> node in the cluster? Or if one knows about the image (maybe the master) can it deliver the file system layers to the others?</p>
<p>I would just try it out myself and see what happens, but I'm probably still a couple days away from even knowing how to try this. I haven't figured out how to run arbitrary shell commands inside of my Kubernetes cluster -- I can just create pods, replica sets, deployments, and services. Before I dive down the rabbit hole of learning how to build my image on my Kubernetes node, I wanted to figure out if it was even worth my time.</p>

stevendesu
<p>If your goal is to not to depend on a registry as a service like docker hub, then you can install your own private local registry by following the docker instructions here :</p>
<p><a href="https://docs.docker.com/registry/deploying/" rel="nofollow noreferrer">https://docs.docker.com/registry/deploying/</a></p>
<p>Then you can configure Kubernetes to pull your images from your local registry. Here is a sample that I found in a quick Google search:</p>
<p><a href="https://tortuemat.gitlab.io/blog/2018/03/18/kubernetes-with-local-registry/" rel="nofollow noreferrer">https://tortuemat.gitlab.io/blog/2018/03/18/kubernetes-with-local-registry/</a></p>
<p>Having said all that, I should point out that at this point docker hub has become such as standard, that it will not go away anytime soon. It would be as if npm or apk disappeared</p>
