Search code examples
dockerdocker-registry

docker difference between private registry and the local image registry?


I have something on my mind that is bugging me. When running docker images I see a list of my local images I have in my docker environment. When pulling Images I pull it from a registry and more specific pull the specified tag managed by the repository.

  • so there is the registry as the big hub to store all image repositories
  • and the repository is storing commits/tagged versions of a specific image

But what is docker images then? It's a registry as well isn't it? It holds all images that I've built locally or pulled.

If my claim is valid:

How does it comply with running a private registry (mentioned here https://docs.docker.com/registry/deploying/)

Running this docker run -d -p 5000:5000 --restart=always --name registry registry:2 Would deploy this new registry into my docker images...

So now I have a registry within my registry... registception? What is the difference besides the custom registry is deployable?


Solution

  • Its not a local image registry as other questions have pointed. It is an image cache. The purpose of the image cache is to avoid having every time to download the same image whenever you do a docker run.

    docker images simply lists all the cached images on the machine. Whenever there is newer image on the registry, the image(some layers) are downloaded and cached when doing docker pull .... Also, when a layer exists in the local cache, docker tells you that, example:

    Step 2/2 : CMD /bin/bash
     ---> Using cache
    

    On the other hand, a docker registry is a central repository to store images. It provide a remote api to pull and push images. The local image cache does not have this feature. Images in the local cache are read and stored used local docker commands that simply read files under /var/lib/docker/...